From the Super Mario Wiki, the Mario encyclopedia
The Wandering Soul is a lost spirit found in Blowhole Castle in Wario: Master of Disguise. Wario discovers it inside a purple treasure chest in the room where the statue of Stuffy the 5th is found, near the top of the castle. When Wario is impeded by a flaming wall of spirits, Tiaramisu speaks to them and tells Wario that they are upset because one of their friends is missing. Returning the Wandering Soul calms the spirits, allowing Wario to move on and battle Stuffy the 64th.