Though great advices and best solutions are mentioned above, it is not easy for many guys.
I remember when I was thinking about a girl I was working with, I could care less about any other girls because I felt that great emotional attachment (perhaps love). There was a situation a girl was pulling off my pants and trying to give me a BJ, she alrady had my dick in her mouth but I simply pushed her away as I couldn't stop thinking about the other girl. You could laugh but it is also a reality.
So it is very tough, and it of course depends on how sensitive the guy is.
I would recommend:
1. Follow the advice above, it's definitelly #1
2. Try not to think about her, keep busy, go lift weights of whatever. Don't think about her before you go sleep, avoid imagining being with her
3. Monitor the level of emotional attachment to her (this will help you in the future); Once you recognize the 'emotional bond', see if you can develop emotional coldness
4. Play a Nice Guy at work. Smile at her nicely, give her puppy eyes, become a friend with her.... Don't worry, she'll be out of your sight in no time, she'll be avoiding you for months
5. Practice discipline of not letting yourself fall in love
6. List everything that you do for her (e.g. constantly thinking about her), and list what she does for you (hopefully NOTHING, LOL)
7. Learn from this experience. The greatest thing you can learn about is the emotional attachment (love), those feelings you have for her. Observe how you create those feelings by constantly thinking about her and imagining things with her. Observe the level of anxiety or shyness while around her or talking to her (assuming that you are shy). Get consciously rejected, another great thing to learn. Simply wait till the attraction expires and then ask her out. You know that she will not go, you may feel some pain but for the purpose of practicing even pain is your great friend.
Simply take it as a great opportunity to learn, don't waste anything, including rejection...
PS My personal solution is to go to a strip bar, it works great, LOL, but whatever