Boost. If it's not an apparition and has mass the body will get pinned against the rear door which you open and boost again. If it is a ghost then I guess getting slime on you is the worst that could happen. But if it's a poltergeist, yah, you'll be spam in a can.
I keep thinking about Event Horizon where the ship is alive and starts showing you things you don't want to see through telepathy. Experiencing hell without physically being there.
I'm afraid it's not that easy. Behind you.....Well, I close the door because my ship's power generator actually works, and then I eject all cargo. Simple.