All I know is that you shouldn’t be scared. It probably ran away because you scared the sh** out of “it”, whatever that thing is. I mean, the worst possible scenario (if this was a ghost) is it attempting to harm you. Trust me, if ghosts exist and if this thing wanted to harm you, it would’ve done so already, because I doubt ghosts have fun scaring the sh** out of people and seeing how they react :)
I think I have a more plausible explanation though. It happens to me often: You see someone you know approaching you from far away, and then you look around, and then you look back and find him/her closer than you expected. Our sense of time passing changes dramatically throughout the day [fun time passes super fast, boring time passes super slow]. Maybe (and most probably) what you saw was just a person who knew this was the wrong office and decided not to disturb you, and thus walked away. The adrenalin rush you had perhaps changed your perception of time and your other senses and made you think you were quick enough to see him/her before he/she left the hallway.
Remember that your brain shows you what you perceive, so your perception might not be reality itself. If your brain is too worried or scared, it might make you perceive things that are not there really, like when you think you heard someone called you although no one called you. It doesn’t mean you’re mad, but it’s just some neurons probably mis-firing, causing weird feelings or even weird sounds or visual images. For example, if you stimulated certain parts of the brain, the test subject will actually hear things [if it’s the auditory area that’s being stimulated]. You can even cause the test subject to smell things that aren’t really there, and it happens to normal people in their daily lives. Are they smelling ghosts? I don’t think so. As far as I know, the networks in brain are so complex that we don’t really know how exactly complex images/sounds are formed.
If you feel scared or worried, reading books/articles or watching videos on how brain works and how it perceives things will ease your worries ;)
Oh, and just out of curiosity, what did you mean by “This building is supposed to be haunted, but mainly on the floors above me.”? We might have plausible explanations for that as well ^__^