First of all make the distinction regarding if this spirit is a bad spirit, a friendly loved one or guide who is coming in. We are not usually aware that we can be visited by those of the light, we assume that the energies around us are of the dark. Now if you feel it is a dark force that is different, and then there are steps to take.
If something does come into your room, you can ask the higher beings of light to come in and take away the spirit, sometimes you can say to the spirit “you need to go to the light, you are not welcome here, and please do not come back, I am calling on the guides and angels to come and get you, please follow them to the light”. I know it sounds so simple you wonder how can it work, but with intent, love and the power within us we can make it so. Some spirits come to us because they are lost and need direction to the light. Some spirits are just evil forces from other planes. Now if it is a loved one and they are coming through to pass on a message or to be near to you to support you, and if you do not mind then you may allow them to be there in your room.