every time I try to friend a girl on campus when I ask for her number, immediately they think oh he is hitting on me. not every guy wants to hit on you, some just want friends. its really annoying and what does it actually mean.
They might not like you that way, and are just trying to let you know that before you get too attached. Even though not all guys are hitting on girls, most are and it's just instinct to say "I have a boyfriend" when a guy they don't like comes up to them. I've done it once myself, but only because the guy asked me out. Sometimes it's the only way to reject someone without being too mean. It just seems better to lie and say "I have a boyfriend" than say "I don't like you and I really don't want to go out with you."
They think you try to flirt with them so they just tell they have boyfriend to avoid you from getting closer with them.I don't simply tell guys I have boyfriend unless if he shows any clear signs that he wants to be more than friends or something.
Usually when you ask a total stranger (of the opposite gender) for their phone number, it implies that you are interested in them. You can't expect a total stranger to want to be your friend anyway. They know nothing about you.