Didn't we just have this thread? Because I'm pretty sure we just had this thread.

But hey. Let"s say you didn't find your answer in that thread. So let me try to summarize:

Shortly: a game master is most justified in negating a player choice to get the outcome they want, when their ability to do that does not stem from them simply being a game master.

At length: the rule you're probably thinking of when asking this question is "a game master has final say over game events".

That rule does not exist to do what you are asking about. That rule exists to establish game master as a referee figure: so that when other game rules either don't give a definitive answer or give contradictory or non-sensical answers, a named person at the table is empowered to make a ruling to cover that case so the game can move on.

So forget that rule and look at literally all the other rules of your game, and all the other roles besides rules referee that a game master has.

Firstly, as a game master, you are very likely also playing the opponent characters to player characters. The basic rules of your game very likely posit these opponent characters can do a number of things to interfere with player characters and their agendas, in a way no different from Chess, or Poker, or any other adversarial game.

Second, as a game master, you are very likely also part-time game designer or at minimum a scenario designer. You are responsible for thinking up boundaries and details of the game situation your players are going to deal with. Others have adviced you to not give your players choices you aren't willing to follow through, but it's equally important to follow the reverse: give your players choices you are willing to follow through. Plural form is important. If you only want one specific result, your entire question is just an attempt to justify railroading.

Don't confuse negating choices that are wildly out-of-bounds for what you are asking about. Forget everything you think you know of roleplaying games and imagine a game of soccer instead. It's a basic objective of the game to kick the ball into the opposing goal - if someone starts goofing off, throwing the ball with their hands, hitting it with bat, trying to hit their own side's goal or other players, the referee is perfectly justified to warn that guy (yellow card) and, if that warning is not heeded, order them out of the field (red card). That's not about enforcing the result the referee wants, it's about enforcing the rules everyone nominally agreed to when they sat down to play. If a referee is abusing their power to make those calls to get the result they want from the game, they are being a bad referee.