Here’s a comprehensive list of tactics I’ve found work against ninjas (with varying levels of success).
1) Tag Temple: A Temple at the entrance of a level will force the ninja to use its smoke bomb immediately. By the time it approaches the gems, it’ll be vulnerable to whatever towers you’ve stocked near the cave – and if you’re using this strategy, you should have a LOT of towers here. Best used on larger maps, or in combination with Meteor – particularly for Champion ninjas.
2) Tag Den: Similar principle to the Tag Temple, but with a Den at the entrance. Normal and Orcish Dens work best, but Ballista Dens can be effective in groups.
3) Tag Crypt: Risky due to the Crypt’s slow fire rate, but staggering the things along a patch of snow (instead of clumped up near the entrance) works to hit the maximum number of ninjas. Most effective with Chilling/Fearful Crypts and the Fear and Freeze-boosting skills in the Undead tree. Also a fairly decent tactic for Champion ninjas.
4) Hellfire-Ballista Combo Mainly useful on later levels, especially against the ungodly tough Champion ninjas they throw at you. If you put a Hellfire Temple at the entrance and surround it with Ballista/Catapult Dens, you can Daze the ninjas (slowing them down) and pummel them with the splash damage from the Dens. After that, even the toughest Champion ninja will be vulnerable to your remaining towers and/or some Meteors.
5) Meteor Spam: If the ninjas are getting close to your gems and your last line of defence isn’t cutting it, a Meteor or two can hit them even while cloaked. If you max out the Meteor Mastery skill in the Demon tree, you’ll one-shot any non-Champion ninja in the game (and even a few Champion ninjas). For the later Champion ninjas, you’ll need to max out Meteor Study and as many mana-boosting skills in the Undead tree as you can (with maximum damage, minimum cost, and highest possible mana pool, you’ll deal 2000 damage). In general, though, Meteor Spam is best used in tandem with the above strategies to optimize your damage output.