As this fine answer explains, a dispel magic effect may end a power word pain effect, but the earliest such an effect’s available is typically the 2nd-level Sor/Wiz spell dispelling touch (abjur) (Player’s Handbook II 110). This makes a potion of dispelling touch (300 gp; 0.1 lbs.) or an arcane scroll of dispelling touch (150 gp; 0 lbs.) (both created using a 2nd-level spell at caster level 3) a reasonable purchase for anyone in a party that—so far—has only been watching the spell power word pain be used against foes.
Any effect that renders a creature immune to mind-affecting effects likewise renders a creature immune to the effects of power word pain as all spells of the school of enchantment are mind-affecting. However, immunity to such effects is typically a high-level effect (e.g. the 8th-level spell mind blank (abjur) (Player’s Handbook 253), the face slot magic item third eye conceal (Magic Item Compendium 141) (120,000 gp; 1 lb.)).
A DM that’s struggling to challenge a group that’s decided to run away after opening every encounter with a power word pain spell—letting the spell do the killing for them—might find the game more interesting if he confronts such PCs with more creatures of the types construct, ooze, plant, undead, vermin, and so forth as such creatures are, by default, immune to mind-affecting effects.
Note that even the handful of things that should prevent the effects of a power word pain spell often, in fact, don’t. For instance,—and I’m not making this up—the nipple clamp of exquisite pain (Book of Vile Darkness 118) (8,000 gp; 0 lbs., and let’s thank heavens for that) that makes “(t)he wearer… immune to debilitating pain effects” also says that the wearer “is not immune to actual damage described as pain,” which should likely include the damage dealt by a power word pain spell’s effect. Similarly, the 2nd-level Clr spell ease pain (conj (Book of Exalted Deeds 97) says, “If the target creature is under some effect that causes continuing damage, the pain is eased only for a moment,” and so the power word pain spell’s effect would be briefly abated… then start up again! It’s almost like the power word pain spell was written to bypass such effects deliberately.
In short, the spell power word pain kills creatures… and PCs. If the PCs are using it in every fight, then enemy wizards should be just as willing to use it in return… as should clerics that pick the domain Magic and anyone with sufficient ranks in the skill Use Magic Device, an arcane scroll of power word pain costing a mere 25 gp. The spell’s big limiter at low levels is its range, so wizards—or those mistaken for wizards—should remain the obvious target in any group of foes if the spell is common in the campaign. And any foe affected by a power word pain spell should behave like a PC who knows that he’s going to die anyway: by extravagantly expending all of his resources to kill the dude who has already killed him, especially since his death will be—in terms of combat rounds—slow and, of course, painful.
Also, although the spell power word pain lacks the descriptor evil, the spell is, by any measure, cruel, and this DM has many folks treat with contempt and hatred those dishonorable casters that employ the spell against intelligent creatures. Your campaign, of course, may vary.