Here are some of the things I try to do to avoid these game downers (and there's nothing I hate like a game downer):
- NPCs healing in mid-combat: Unless it's a "heal" spell, at most it buys the NPC a couple more rounds, so my NPCs tend to favor inflicting damage and/or incapacitating PCs to get a breather.
- Super-Defense: I try to convey to the PCs _why_ the attack failed. If it's Spell Resistance, I describe to the casting PC that he/she feels an almost tangible barrier protecting the creature, like pressing your finger upon armored skin. _Then_ I ask for the caster level check. If the PC in question has a reasonably good chance at beating the SR, I say that the spell _almost_ breached the defenses before collapsing, so the PC feels encouraged to try again. Ditto for Damage Reduction.
- Teleporting foes: This can be a MAJOR bummer, and it's one of the reasons I liked the "Squaring the Circle" adventure in the Planescape: Hellbound boxed set, where you can play an active part in stripping the fiends of their teleporting powers. Here are two suggestions on that:
1) Bring back Dimensional Anchor. Drawing sigils on the ground to trap demons is a staple in fantastic literature.
2) Track the Teleporter. Teleports and Dimension Doors (and pretty much all dimensional travel) leave behind residue energies from the spell that linked two different places for a short time. With a successful Spellcraft check (say 20+spell level+foe's Int modifier+2 for every round after the teleport) a spellcaster can figure out just where the enemy went (in broad terms), and a specially tailored teleport of the same level or higher, if cast on the same spot (within 1 minute of the enemy's teleport), can take the caster (and friends) to the general vicinity of their enemy.