It may seem impersonal at first glance, but even assuming that the woman is being honest about being in a relationship and isn't simply making one up in order to let a guy down more easily, it's worth considering whether she really has a "boyfriend," in that she's in an exclusive relationship which is at least somewhat serious, or whether she's merely dating a guy (or two) in a casual way. And the truth is, unless a woman is very serious about her boyfriend, women will jump ship if they have a better offer. When she rejects a suitor by saying she has a boyfriend, the unstated addendum is "and my boyfriend is more desirable than you." It's not as though having a boyfriend is a covenant signed in blood which disallows a woman from ever seeing another man. If she was attracted to you enough, she would in fact just cheat on her boyfriend with you, or dump the guy to date you, etc.

And, at the very least, if the women is attracted to you, but too committed in her current relationship to make a move with you, she will likely at least want to keep you "on retainer" for if/when she breaks up with her current beau, so that she has a desirable guy to pivot to.