Dungeon Spirit

A Dungeon Spirit is a small blue flying enemy that can go through walls, that drops Ectoplasm. They will not spawn until you have defeated the hardmode Jungle boss, Plantera.

After defeating Plantera, whenever you kill an enemy with 100 or more health points in the hardmode Dungeon there is a 6.67% chance of a Dungeon Spirit spawning.

They are immune to the Confused debuff.

In Multiplayer they sometimes spawn without having killed Plantera, but less frequently.

Tips
An easy way to farm dungeon spirits is to make a mob farm using a Chest Statue, as Mimics have 500 max health, making them eligible to drop the ectoplasm when in the dungeon.