Also see ways to prevent teleportation.
Ways to prevent scrying
Many countermeasures to the 4th-level Sor/Wiz spell scrying [div] (PH 274-5) and the 7th-level Sor/Wiz spell greater scrying [div] (PH 275) and other spells of the scrying subschool exist, but some of those countermeasures perform inadequately.
The list below omits scrying countermeasures of the illusion school, like the 5th-level Sor/Wiz spell false vision [illus] (PH 229) and the 8th-level Sor/Wiz spell screen [illus] (PH 274). Because a "[scrying] sensor has [the caster's] full visual acuity" (PH 275), illusion countermeasures are rendered moot by a caster savvy enough to activate an effect like true seeing before casting the spell scrying et al. or during the spell's duration. I assume that a defender assumes that all casters are savvy enough.
The list omits effects the caster can overcome by making a successful caster level check or saving throw, like the 3rd-level Sor/Wiz spell nondetection [abjur] (PH 257). I assume that a defender assumes that the caster prepares for such countermeasures and can trivialize them with temporary bonuses, especially as it's usually a more powerful creature with resources to burn that picks as a subject a less powerful creature.
And, while such effects are countermeasures, I've never seen antimagic effects—like that created by the 6th-level Sor/Wiz spell antimagic field [abjur] (PH 200)—not lead to arguments at the table, so means to create such effects have also been omitted from the list because I like my friends.
The list omits countermeasures that are unavailable to most creatures, such as becoming fettered to the caster of the 9th-level Sor/Wiz spell imbrue [conj] (Dragon #336 81), acquiring the template Vecna-blooded (Monster Manual V 66-7), or becoming an object upon which is cast the 2nd-level Sor/Wiz spell obscure object [abjur] (PH 258). I have boldly assumed that, for example, most folks' characters won't be somehow-sentient sandwiches.
Finally, keep in mind that the spell scrying et al. are not spells with a target as they've no target entry in their descriptions. Instead, the spells create an effect that causes the subject to make a Willpower saving throw and the caster to overcome the subject's spell resistance. This renders the spells unaffected by, for example, the 7th-level Sor/Wiz spell spell turning [abjur] (282-3).1
- "Lead sheeting… blocks a scrying [subschool] spell, and [the caster can] sense that the spell is so blocked" (PH 173), but the core rules don't describe exactly what lead sheeting means (i.e. there's no cost, weight, hardness, hp, etc.), making lead sheeting usually not much help to the typical murderhobo. However, because lead sheeting is still a thing, the DM can say that, for example, creatures inside any structure or vessel are immune to spells of the scrying subschool because that structure or vessel incorporates this mysterious substance.2
- "Any creature with an Intelligence score of 12 or higher can notice the [scrying] sensor [created by spells of the scrying subschool] by [succeeding on] a DC 20 Intelligence check" (PH 173), by employing the 4th-level Sor/Wiz spell detect scrying [div] (PH 219-20), by wearing a ring of scry detection (Dragon Compendium Volume 1 127) (28,000 gp; 0 lbs.), or by being able to perceive the invisible. While this isn't per se preventative, noticing the scrying sensor allows a creature to respond appropriately, but unless the target has unlimited dispel magic et al. spells, the best defenses will be mundane. Because the typical "sensor has [only the caster's] full visual [and, often, aural] acuity" (PH 275), when a scrying sensor's detected either creatures can, possibly, hide from the sensor and whisper while continuing their business or act like the sensor went undetected and sow discord or disinformation. The spelltouched feat Eyes to the Sky (Unearthed Arcana 93) deserves special mention for its benefit enabling automatic detection of scrying sensors even by the Int 3 barbarian.3
- The circlet of convocation (Dragon Compendium Volume 1 133-4) (4,775 gp; 0 lbs.) deserves special mention as a scrying deterrent. In addition to its other effects, expending one of the circlet's 5 charges upon noticing a scrying sensor causes the wearer to—poof!—appear adjacent to the scrying sensor's creator, presumably so the wearer can beat the crap out of the creator but maybe just so the wearer can call the creator a perv to his face. The range the circlet can transport the wearer appears as unlimited as the range of the spell scrying et al., even capable of transporting the wearer to a different plane, but ask the DM. However, the wearer must find his own way home.
- The 4th-level Clr spell spell immunity [abjur] (PH 282) et al. grants unbeatable spell resistance against the spells (but perhaps only if the spells are cast at the appropriate levels—there is some debate). However, because the subject never knows when a nosy caster'll be peeping, the spell immunity spells' 10 min./level durations make them only of limited utility.
- The 5th-level Sor/Wiz spell Mordenkainen's private sanctum [abjur] (PH 256-7) for 1 day prevents scrying in an impressively big area. This is what creatures use when they aren't on the move. Conveniently, the effect can be made permanent using the 5th-level Sor/Wiz spell permanency [univ] (PH 259-60).
- The spell 5th-level Sor/Wiz spell scry trap [abjur] (Magic of Eberron 101) is a scrying deterrent that deals damage to the scrying sensor's creator. While its 1 hour/level duration seems unpromising, the spell can be cast after the scrying sensor's discovered. A similar effect is available once per day at a reasonable price via the deathglance locket (Dragon Compendium Volume 1 134) (3,860 gp; 0 lbs.). More preventative but potentially more dangerous is the 4th-level Sor/Wiz spell psychic poison [abjur] (Book of Vile Darkness 101), its 1 hour/level duration easily extended so the effect lasts all day. But, like the 3rd-level Sor/Wiz spell anticipate teleportation [abjur] (Spell Compendium 13) et al., the psychic poison spell's subject should warn allies that such an effect's present. (Also, Vile Darkness omits psychic poisons' saving throw DCs so the DM must rule on them.) The more violent spelltouched feat Live My Nightmare (Unearthed Arcana 94) is an interesting and unexpected deterrent but, given the probably low saving throw DCs against its effect, won't remain a deterrent for long.
- The 8th-level Sor/Wiz spell mind blank [abjur] (PH 253) for 1 day renders the subject undetectable to scrying spells. This is what serious casters use, but other folks are stuck with items granting a mind blank-like effect that cost over 100,000 gp, which is still half a PC's wealth even at level 15 (when a wizard can just cast the spell mind blank). It's not until level 17 when an item like the cortical armor (Underdark 71) (146,650 gp; 25 lbs.), cowl of warding (Magic of Faerûn 156) (208,000 gp; 25 lbs.), or third eye conceal (Magic Item Compendium 141) (120,000 gp; 0 lbs.) becomes an almost reasonable purchase. However, the ioun stone (black and white ellipsoid) (Dragon Compendium Volume 1 137-8) (60,000 gp; 0 lbs.) is available a little earlier to the utterly paranoid, providing the mind blank spell's defense against scrying yet none of the mind blank spell's other benefits.4
- The 9th-level Sor/Wiz spell Halaster's scrying cage [abjur] (Expedition to Undermountain 219), in addition to other effects, permanently causes to fail any spell of the scrying subschool cast "into, out of, and within" the warded area, which is a 10 ft. cube/level.
(Richards and Sernett's "I Scry: Spying and Divination Magic Items" (Dragon #319 63-6) introduced the items above that were reprinted in Dragon Compendium Volume 1. Kudos to the authors for supporting this largely overlooked minigame.)
As an aside, in campaigns that I DM the PCs' foes start scrying on the PCs when the PCs are about level 5 and stop when the PCs are about level 13. By that time, the PCs either have ready access to scrying countermeasures or have become skilled enough to make scrying on them a fruitless endeavor. I don't have foes constantly scrying on the PCs—that takes tremendous resources—, but, instead, the foes try to peek in on the PCs about once a week in a long-running campaign. And, if a foe is really struggling to spy on the PCs, the foe'll pick as the scrying subject a PC's associate, cohort, follower, friend, mount, or pet to see if one of them is an easier or more interesting scrying subject.
1 A DM that house rules the spell scrying et al. nonetheless are targeted effects allows the spells to be absorbed by magic items like a rod of absorption (DMG 234) (50,000 gp; 5 lbs.) and directed back at the caster by the magic weapon special ability spellblade (Player's Guide to Faerûn 120) (6,000 gp; 0 lbs.) keyed to the appropriate spell as well as the aforementioned spell spell turning and similar spells and magic items.
2 When I DM, I include in the campaign's introductory material that this is an actual thing so PCs can make Knowledge (arcana) checks (DC 10) to know appropriate shelter's usually available somewhere. Further, PCs aren't themselves surprised later when they cast the spell scrying et al. yet find such spells blocked. Also, to be fair, I have lead sheeting included at no extra charge in the price of structures or vessels PCs have built on their behalf if they want. Finally, if using the Stronghold Builder's Guide, lead-lined walls cost 1,000 gp per stronghold space (37); I've found most folks just don't want to bother with the Stronghold Builder's Guide, though.
3 The feat Eyes to the Sky is how I presume Conan deals with scrying sensors. Not that I think you're Int 3, Mr. The Barbarian.
4 A reader may note that mind blank says, "Scrying attempts that are targeted specifically at the subject [of the spell mind blank] do not work at all," yet the spell scrying et al. aren't targeted; this DM recommends a house rule saying that mind blank stops cold the spell scrying et al. rather than a house rule that makes such spells targeted spells.