It's OK if the ghost is outside. If he can't sleep in the inn because of monsters, then there is something INSIDE the tavern. Search through the area and find and kill it. Then you can sleep after you buy a room.
Not necessarily. Back when DF was still current, I remember trying to sleep at an inn (After having the room for several days, with several days left on the ticker), only to have the enemies nearby error keep popping up. I go outside, and there's a wearboar wandering around outside. I kill it, then have no problem sleeping. I don't remember if I had a mission active, but I know that it was inside a walled city in the desert provinces.
EDIT: It might have something to the enemy having targeted your character before you go in the inn.