When I started my first D&D campaign as a DM, I accidentally rolled and confirmed a crit on a PC from a goblin. It was an instant kill as our campaign had no cleric. That time I decided to fudge the dice. Now, there's a similar problem, but this time the PCs are at 3rd level and they are dealing with a very important NPC. If they fail this one diplomacy check, the entire game world will fall apart, as the king would then send his entire army against the PC's homeland and will destroy it, plunging my entire game world into chaos, at which time drow that I wanted to save for a later adventure will have to come out, which will instigate a wizard's guild to release their secret ultra-deadly virus, and everything in my game world, including the PCs, will die. So should I fudge the dice roll? When is it good to fudge it?
Understand what makes the game fun for your players and then try not to back yourself into a corner where you feel pressure to fudge rolls in the first place.
If character death is acceptable to your players then you should feel no pressure to erase a crit. If it is not then you should have death or resurrection mechanics which allow for the player to take that hit without ending the game or the fun.
Similarly if you have constructed an encounter where failure means "game over" and you are not ok with that then that is something you need to address or else you will run into the same situation again.
There are cases where you might want to fudge a roll because otherwise it makes the game not fun (and your players are ok with it). For example, the player might try something that cannot possibly succeed, but you give them a few hidden bonuses to make it possible (but not guaranteed) because 1. You have a plan for how the failure will be good for the game, and 2. This allows you to say "yes" to their idea and build on it rather than shut it down. You might also present a challenge the party will not be able to fail if it highlights tension and feels risky to avoid just narrating that part of the story. However in that case you had better be prepared for the players to roll 1s, so switching to a success or failure-with-consequences plan is probably a better idea.
In short. Try not to fudge rolls. Not because it is bad or wrong but because wanting to do so is a warning sign that you have already made a mistake.
Personally I roll in the open but keep the dc values to myself for the players to discover.
As others have said, this is a matter of style for your group.
However, my feeling is that you should never fudge a dice roll. They are supposed to create drama and give mechanical meaning to the players work in setting up the roll in their favor. Fudging them on any kind of regularity removes both of those. That doesn't mean you always blindly accept them though (unless that is what your group agreed on, and some groups do indeed want to always follow the dice).
First, if the story requires a certain outcome then don't roll. In most groups, it is perfectly acceptable to declare certain results by fiat. (On the flip side, it makes sense not to roll when the results are guaranteed to be predictable and boring. It just speeds up the game.) Roll the dice when there is tension and drama, and when you as the GM are ready to abide by the results.
Second, if you object to a roll, you can mitigate. That does not mean make the roll meaningless. The roll was supposed to create tension and it won't do that if the players know you will overrule certain things lightly. Instead, let it stand as is, but something else happens to mitigate the harsh results. A crit causes an instant death? Well, the character does take the damage, but (depending on setting and tone) the heroic will of the character lets him keep breathing barely until the battle is finished and help comes, or a friendly deity steps in to preserve him, alive but unconscious, or the place the battle is on happens to have a magical aura that stops anyone from dying there.
In short, you are taking a "Yes, but..." approach to the dice roll. People may object that this is "Deus Ex Machina". They would be right (and in the second one, literally so). But, you avoided directly overruling the dice, and you preserved drama because there were consequences. The character is now out of combat, and in two of those cases you added consequences that could be plot devices later. (The character now owes a favor to the deity that preserved them, and such favors will get called in...or they have a strange magic aura to investigate and also their enemies were knocked unconscious instead of dead so they have to deal with that...)
It is group dependent, but I personally and most of those I game with find "Yes, but..." better than removing the tension from the dice even when it explicitly means using Deus Ex.
The Immediate Issue
Don't make the dice roll about X thing that the world will fall apart. Make the roll about "how much has to be paid/given up to get it", "things the person(s) they're negotiating will ask for" etc.
For example, I have a scenario where a party has to go to a dwarven mining camp to negotiate having the dwarves repair a bridge that was washed out BEFORE trade season starts. As long as the players say, don't try to murder everyone, a deal WILL be brokered, the rolls and roleplaying are more to do with how much does it cost? What other sorts of information or trade deals can they negotiate on the side ("Actually, we'd also love to get some Dwarven steel, too"), etc.
A pretty good rule that game designer Jared Sorensen said, "If a dice roll will break the game, don't roll the dice for that thing".
Notice that this isn't the same thing as fudging. You tell the players what they're rolling FOR and they're invested enough to go for it. You don't hide or lie or change the results, you just determine what's worth rolling for and what isn't.
I figure whoever has the power to make the gameworld fall apart CERTAINLY has leverage to potentially ask for some pretty heavy concessions in return ("No humanoid shall step upon the northern continent again", "1000 firstborn children are to be sacrificed to me each year", "My chosen descendants shall rule this land" etc.)
Now, maybe, you can see a situation where "game world falls apart" still can be roleplayed in? If so, consider actually making the roll. (I'd probably make it best of 3, or best of 5, and give each player one of those rolls, it'd be stuff like "Get the councilor on our side", "Get the Alliance of Clerics to support us" or similar.) But it sounds like that's not really the case here, so don't make the roll about that at all.
The Larger Issue
I'm not a fan of fudging dice rolls. I feel it destroys trust at the table and makes the players less interested in engaging the mechanics ("Why should I bother, X thing is going to happen no matter what I do?").
The first point is that you can avoid problems like the one you stated simply by changing the stakes- if something would break the game, that's not what you roll dice over - you roll dice over how much it's going to COST the group to do it.
But some things, particularly damage and death, are well hard-coded into D&D rules. (That said, death is rarely what people are fighting for in most stories and real life...) In those cases, consider some options:
Pulp Death Rules
PCs do not lose HP after going to 0 or negative. They simply regain 1 HP per hour while unconscious, until they're at 1 HP.
Give the party a pool of points they can spend. These can do serious things like halve the damage received, or turn a killing blow into a knock out, etc.
When a Villain would normally land a killing blow, once an encounter, the party may instead give the GM a Villain point. The damage is either negated or halved or turned to a knockout, and the GM can later spend that point, at a different encounter, to give a Villain one extra action.
The trick you'll notice with all of these is that they help you cut out the reasons you'd want to fudge in the first place AND they keep the plot immunity/plot direction issues above the board so no one at the table has to lie, be lied to, or doubt how the mechanics fit into the action.
If the consequences of the failed diplomacy were an interesting complication instead of complete, game world-ending failure, then you don't have to fudge the roll.
If the group agrees on the lethality of the game, then you don't have to fudge the roll.
Establish expectations with the group when you start the game. For example, I don't fudge rolls, and I'm quite up front about it when I run for new players. I would rather engage the system on its terms and watch the game occasionally take some unexpected twists as a result of play. If the roll is going to be fudged, why roll?
All in all, I'm not really a huge fan of banking all of one's odds on a single die roll. On the one hand, the last thing you want to do is blow up a game because someone's d20 slipped. On the other hand, I think there's a moral hazard to fudging in that all the edges in your world seem to soften. Some players will take advantage of this. Others will flat-out dislike it; if there's no cost to failure, what does success even mean?
Instead of thinking of the situation as win/lose, try and see if you can put it in terms of "win/consequences". If the party makes the roll, sure, let them do what they want there, but if they fail it, instead of saying "nope, you can't do it", try to find a way to say "you're able to proceed but now you have to do X first", or "the duke is unconvinced and will not finance your expedition... but perhaps you could take out a loan?". I'm only giving that as a broad example; the point is to come up with something that will complicate the PC's lives, not stop them cold.
There's nothing inherently wrong with fudging a roll or two, however, it's a trap.
Given the essential random nature of the games we play (they use dice!) sooner or later situations like this will happen again and again and you need a way to deal with this one way or another.
No blanket policy can tell you when to fudge. This is something that will vary from group to group and even player to player.
While I think it's usually a good idea to get player feedback on things like this, you need to be aware that players lie. They absolutely want to believe their character who is a stupendous badass who needs no safety net. That doesn't mean they want you to never fudge! "No safety net" means they never want to see you fudge. "Stupdendous badass" means you might have to. Both illusions must be maintained to make that kind of player happy.
I don't think you should rely primarily on dice in such situations. For an important diplomatic encounter, make the group role-play it out. If they do well and make a persuasive argument, there's no need to roll. You know the NPC's point of view - there's no randomness necessary to know whether the PC's offers are to his benefit or not.
You can use the diplomacy rolls as a fallback. If the PCs don't make a very good argument... then perhaps they should make some checks. And it doesn't have to be all or nothing. You can break it up into multiple diplomacy checks. Did they greet the NPC appropriately? Did they display a proper etiquette? Those can be separate rolls, and the final results evaluated based on their overall performance. Much the way a thief breaking into a vault might have to first roll to find traps, then disarm them, then unlock the first door, then unlock a second door, etc. It’s not a single roll, and there's no reason a diplomatic encounter needs to be either.
As far a fudging in general... that’s, as they might say, a personal choice. Every GM, every campaign is slightly different. I'll personally fudge the dice whenever I feel the results dont work well for the game. I won’t fudge to railroad a group, or force them to lose a particular combat. That's not fun for the players, and is much too blunt a blade. It has to be subtle, and seamlessly fit into the flow of the game. For example, if I want to swing some momentum to the PCs in a combat, I might fudge a few rolls in their favor. Others won't fudge any dice rolls. Others still may not fudge rolls, but they 'fudge' in other ways - with raise dead or remove curse scrolls showing up at surprisingly convenient times, for example.
Ultimately its up to you. It’s your game, so express it in your way.
There is a tradeoff.
Fudging dice rolls, whether in favor of or against the players, reduces randomness and makes adventure design more manageable for the Gamemaster, because he need not account for nearly as many permutations of possible outcomes. They often do so in favor of and with the approval of their players. There is nothing inherently wrong with this.
It does, however, carry certain inherent disadvantages. First is that fudging roles is just another form of "railroading" a GM technique that is generally disapproved of (some degree of it, however, is a necessary evil because GMs in real life aren't actually omniscient and omnipotent). The players' actions and decisions matter less when you fudge, and contributes to cultivating a sense that they are simply non-interactively along for the ride. Part of freedom is the freedom to make mistakes and experience the consequences thereof.
As a correllary to this, fudging generally creates imbalances between the players, whether they notice this or not. If Player A makes a sacrifice in character choices to prepare for a negative outcome but Player B does not, but the GM fudges to prevent the outcome for both players regardless, Player B is more powerful for having gotten the benefit without the sacrifice.
As an example, in many systems spellcasting types are "glass cannons" that trade off hit points and defense for offensive power, while melee combatants generally have less offensive power but better armor and defenses and more hit points. But if the GM regularly "pulls his punches" to prevent character death, the campaign skews in favor of offense and against defense, leaving the melee combatant appearing weak and ineffectual compared to the spellcaster, since the combatant sacrificed good offense for a devalued defense.
It is, therefore, almost impossible to manipulate probabilities in any game in a way that won't disadvantage somebody unfairly, whether they are aware of it or not.
There are exactly two situations when you should fudge:
Obviously the second guideline ties into the first, which should be the final arbiter for all of your fudging decisions, not just for dice rolls.
The only time you shouldn't (potentially) fudge is when you are demonstrating how your game world operates. If you want your players to know exactly what will happen if they don't make their rolls, you shouldn't fudge.
Remember, though, while you shouldn't hesitate to fudge as necessary, you should avoid fudging whenever possible. It is a means to an end, not a regular component of game play.
Two quick examples based on your original question:
On the other hand, if you want the players to know their place in the world (demonstrating they make a HUGE impact on world events by simply speaking to someone), you may wish not to fudge the example diplomacy role. (It still is bad design, however, to do this type of thing on a regular basis - you have given up control of your game, and therefore control of the fun, to random luck).
Fudging is an extremely useful tool any DM should keep in their toolbox. That said, there are a couple drawbacks to fudging which are well worth thinking about.
The good news is that there are simple fixes for both of these.
Finally, here is a link to another answer I wrote regarding the issue of hidden stats for monsters and non-dice roll fudging. While its somewhat indirect to the original question, it may clarify some questions regarding why adjusting (hidden) target difficulties is good practice in my opinion.
There's not really an exact answer to your question.
Rule 0 (i.e. you can change the rules if you feel like it's needed) is some sort of necessary evil in a game like D&D 3.x (or previous editions) because the rules are seldom tought as a complete and coherent system.
When it's about character death, it comes to the tastes of the players.
I feel really bad when my character dies, be it because of bad luck or unsound tactical decision that wasn't really apparent to me. But I also feel cheated and my contribution to the game is perceived to be lessened if I get saved by the DM instead of thanks to my own choices and skill.
My suggestion is to ask your players, as a group, a preference on saving them or not.
I've seen GM's who fudge just about any bad roll. When playing in these games, the game feels a lot less threatening, but it also means you are encouraged to do things that might hurt you, since you know it is very unlikely to kill you.
I've seen GM's who never fudge any rolls at all. Those games are much more gritty and realistic, with players being a little more paranoid about their actions.
Personally, I almost never fudge rolls, unless it is likely to cause a death I don't think a player has earned. I mean, if a player does something stupid, then I will let the dice fall where they may. But if a player does all the right things, and just gets unlucky, I might reduce the damage reported just a little, so as not to kill the character outright. At least the first time it happens, anyway.
A failed dice roll does not necessarily mean a failed action. What it determines is that the action has suffered unintended consequences which are bad, really bad.
For example, the critical could mean a limb taken off instead of death. The diplomacy failure might create the impression that the PC is a tool only interested in a reward.
Use the dice roll to make the story/drama more interesting. Then there is no need to fudge things.
As both a player and a GM I've encountered situations where a bad roll can mean disaster for the party or the game world. Sometimes - not often, but sometimes - the GM has to make a tough call between fudging the roll (GM rolls critical success for the bad guy rolls on a pivotal action, etc) or trying to pick up the pieces and move on afterwards.
If you really don't want to fudge your rolls - and there is no reason why you should fudge if you don't want to - then you need to figure out how to stop those bad rolls from killing the fun.
But the important thing that I think you're overlooking is that your characters are in way over their heads.
It's all about level-appropriate scope of risk.
As a first-level character my worst possible failure should never cause more than incidental damage to the setting. The absolute worst thing that I should be able to achieve is to get my own fool self killed, and maybe take a couple other party members (of the same level) with me.
At third level, like the players in your question, I shouldn't be able to harm much more than a very small village. It should never be possible for a failure at this level to cause more than minor damage. Certainly the future of an entire nation of people shouldn't rest on the shoulders of a few cut-rate adventurers.
Yes, third level is sooo much better than first. But the job you've got them on seems to me to scope closer to tenth level, maybe higher. In that kind of situation you send professionals, not novices. Hell I wouldn't have guards under fifth level on a mission like that.
But hey, if a bunch of third-level weenies is the absolute best that their nation can manage... well, bugs get stomped.
All The Time
As a GM I basically fudge my rolls all the time to optimize the gaming experience. I do it in a reasonable way and trying to keep the players entertained, and it works pretty well. If I don't want the PC's to die I lower the damage from a strike or the listen roll from a guard. The main point is, you don't need to be victim of bad luck. The gaming experience is more important than being faithfull to dice. If your main goal is storytelling, engaging combats and near death boss combats that thrill your players, fudging rolls is the best way to achieve it consistently. Sometimes I fudge rolls against players too, making them fail tests or attacks or take huge blows. I'm not trying to make it easier or harder on players, the goal is guaranteeing stylish adventures.
It usually works even after players develop a sense of immunity, you just need to keep threatening if you feel you're losing control. But the whole thing about fudging rolls is control. If you control the whole action, than it works just as you previously imagined, for maximum fun. Think about action movies: We all know the main characters will go through thrilling experiences and escape certain death to win in the end, but that doesn't prevent us from having fun. What spoil our movie experience is usually a Deus Ex Machina device screewriters sometimes uses to save characters at the end of the history, and you will never need this kind of thing if you properly control your dice roll, but if bad luck strikes some divine-like intervention might be the only solution to saving your session without TPK, and that's when your players get frustrated.
Actually, fudging rolls in favor of the players allow me to be so mercyless cruel with them in game that sometimes they keep complaining I'm fudging against them! So they don't feel like the challenge was taken from them.
Of course, if the goal of the players is to test their system mastery throughout highly strategic gameplay, than fudging rolls are not going to make them necessarilly happy. It might seem like playing a video game at easy mode. But players that think like that also know you hardly ever make till the end of the game alive playing at expert level.