If a girl tells you she has a boyfriend, the best thing to do is to respect her decision and move on. It's not worth trying to pursue a girl who is already in a relationship, because you're likely to just end up getting hurt. There are plenty of other girls out there who would love to date you, so don't dwell on the one who isn't interested.