Question: When I design adventures, I often come up with situations where the NPCs could realistically thwart the PCs quickly by sounding an alarm. This is especially common in science fiction settings, where the NPCs have access to surveillance cameras, radars, motion detectors, and other advanced technology. This makes stealthy missions difficult to pull off, because the PCs can be revealed in a matter of seconds if they make even a single mistake.

**How do I keep NPCs from just sounding the alarm right way, without suspending disbelief too much?**

Answer: 
I think it depends on what kind of game you want to play. If you are playing a gritty game where getting past security systems is a big part of the challenge during game play (like in Shadowrun for example) then I think you should pay close attention to the details and sound the alarms when the PCs make a misstep. However, if bypassing security systems isn't as important to the story you are trying to enjoy with your players then don't worry about the fine details. There is little reason to focus on being realistic when it doesn't support the story.
Usually in the games I'm a part of, the PCs' status as heroes sort of takes care of the alarm issue. If intruders easily slaughtered the 5 guys guarding your entrance, are you more likely to rush in there, or hunker down and take the best defensive position you can?

For more stealth or skill-oriented infiltrations, my approach is simply to allow multiple failures instead of one bad roll meaning a total failure. For example, a stealth failure could be described as, "A guard starts to turn a corner and his flashlight will shine directly on you. Everyone roll perception to see if they hear the guard in time to warn you." Chances are someone will make it, but then have some longer-term consequence. "You duck out of sight in time, but the guard thought he heard something suspicious and he's starting to check windows and doors for signs of forced entry."