Girls say they have a boyfriend for several different reasons.
Sometimes they will say they it so they won't feel guilty, sometimes they need to be reassured you will be discreet, sometimes it's just a shit test, and sometimes they want you to go away. It is important to calibrate & figure out what she is really saying when she says "I have a boyfriend", as the responses are quite different.
If she's communicating dissinterest and telling you to go away, and you respond showing interest in her, it's not going to go well. Instead you might want to try communicating disintrest, then showing high value.
WF: Geez, do you think ever guy that talks to you is hitting on you? My last girlfriend was like so arrogant like that...
This will give her an oppertunity to quallify to you. I also like,
WF: That is soo cool how some guys are able to look past the physical and date a girl because she is a good person...
But that will usually just piss them off. Funny as hell though.
EDIT: Also can be useful:
WF: Just one?
WF