So, imagine that you are a shogun that wants to get rid of his opponent. You send a ninja on a potentially suicidal mission to kill your opponent and while you're pretty sure he'll get the job done, you're not sure that he'll make it back. Obviously, you don't want to get caught and you pay his clan or family an extra so that if he gets caught instead of killed, he uses a fake tooth with a lethal poison to kill himself so that he can't be interrogated and point at you. A pretty solid plan that can be messed up with just one spell.
That is, "Speak with Dead".
How can you prevent some random cleric from interrogating your ninja's corpse regardless of whenever the ninja had the chance to off himself or not?
The one thing I've thought of was a Contingency of either Teleportation, or Disintegrate, but this requires the ninja to be a high level arcane spellcaster, and at that level, something akin to Limited Wish is pretty easy to come by (to restore/retrieve the body. We're not talking about "retrieve the person that has hired that ninja" in this case). And since Speak with Dead targets the body instead of the soul, soul stealing shenanigans don't really help in this case.
Is there a way to make someone's corpse nontalkative? Preferably in a manner that's not counterable without epic spellcasting, or at the very least, without full-on 5000 xp Wish spell.
Knowledge is key
Obviously, the target can only tell what the man knew before death: preventing him from knowing the one who paid (make him actively prevent others telling their names?) will prevent him from compromising the person. But of course, maybe that is no longer possible. In that case, let's look at the limitations of the spell.
Semantics for the win!
The spell has very specific triggers when it will not work, and you might exploit them:
This can be exploited: an item that casts "Speak with Dead" triggered by the death of the wearer will stop tests within the first week. The caster now would be a person that is not present, so he wouldn't answer any questions, just stand by for a few minutes. Even better, if dying triggers the spell to be cast once a week, it will prevent any questioning.
Destroying the body enough to not being able to speak is a sure way: have some sort of spell triggered at the point of death that immolates the head or blows away the jaw.
An other variant to prevent speech while keeping the body mostly intact would be to use a baleful polymorph spell triggered upon death, that just merges the jaws and lips. Mind, it targets "one creature" — not one living creature like polymorph!
This makes reincarnation not a protection against this spell, but...
Having a triggered spell upon death that raises the ninja as an undead, even for a moment, would prevent the spell from working: it has been turned into an undead creature and if it dies a moment later, it is the corpse of an undead creature without any memories.
Either prevent knowing the boss's name, or render the corpse unable to answer. To do so, you would need to find yourself a magician who is willing to make a custom magic item. This will cost up to (spell level × caster level × 2,000 gp) as it might be considered a "use activated/continuous" effect, or it might be as little as (spell level × caster level × 50 gp) for a "single use, use activated" item. So it might be a bargain.