that depends on how you push the event, there are several possible ideas like checking the target position before the push, having other events on the positions where the event should not be pushed to and a few other options.
Show us a screenshot of how you push the event and we can tell you what you can do.
This might be a bit long-winded, but something like this might work (only guessing as I haven't seen your boulder event)
Paint the sand tiles with region 1 (or whatever region you want to use, and replace 1 with that region id in the below instructions).
Use three variables - two will get the x and y location of the boulder if it were move one step away from the player, the other will get the region id of that location. If the region id is NOT region 1 (or whatever region you want to use), then the boulder can be moved.
In your Control Variables for x, use the following script call: $gameMap.xWithDirection(this.character(0).x, $gamePlayer.direction());
In your Control Variables for y, use the following script call: $gameMap.yWithDirection(this.character(0).y, $gamePlayer.direction());
Use the Get Location Info (tab 3 of event commands) to get the region id into another variable, using the x and y variables as the coordinates.
Finally add a Conditional Branch to see if the region id variable is NOT 1 (or whatever region you decide to use).
In the 'true' block, move the boulder.
In the 'false' block, play a buzzer sound (optional - if you don't want to do anything, don't include the 'else' block at all).
You don't need to turn direction fix ON in the move route. Just check the Direction Fix box underneath the sprite, and it will always be on.
two options here, depending on what you really want to do.
The simpler one is placing invisible events set to below character on all sand tiles.
Below character means that the player can go there, but no event can move on another event unless one of them is set to through, so that will stop the box from moving.
The other option is to add some code to the event before the move to check if the position to move to is allowed.
Besically you would need four conditional branches based on player facing to determine into which direction the event would move.
In each of those branches, you'll use three control variable commands to get the corrodinates of the target tile (two commands to get the event position, then one command to change the event position to the target position by counting the correct coordinate one up or down).
Then you'll use get location info to detect what the target tile is and check with another conditional branch to see if you move there or not.
As you see, using invisible events as barriers is easier, but it might have some sideeffects depending on map size and number of events (too many can cause lag)