Every girl I meet has a fuckin' boyfriend
Age old query around here.
Hot girls have boyfriends. That happens.
But judging by your willingness to step in these two muddy puddles [coworker/boyfriend].
A. You consider her very hot.
B. You don't get out much.
Ask about her bf for example if she is interested in him when you get a chance to talk to her. You will have a clue whether to ask her out or not.
This will just cement the idea you don't have the confidence to do anything about it anyway.
Don't mention her boyfriend and just flirt with her. Then find a place close to the job and invite her to drinks there after work.
Jack is spot on. What my usual tactic against when a girl tells me something I don't like to hear, I just totally ignore it and continue saying whatever I want. Then continue or stop according to her reaction.