I find that whether I get approached is influenced somewhat by my demeanor. If I see them first and make brief eye contact, let them know I see them and what they're doing and have a serious kinda look I guess, I tend not to get approached. If they catch me not paying attention or I just look like I'm unaware or like I'm timid I get approached more.
When I do get approached, sometimes I give a no thanks and keep going. Sometimes I give them something. Sometimes I engage them in conversation and see where it goes. It depends on how much time I have and my mood.
I did have an experience in Dallas last year that was a little more aggressive. Was walking in the evening with my girlfriend and was approached by a homeless gentleman. I walked by and said "I'm sorry, I don't have anything". He followed us for several blocks. Sometimes yelling at us, sometimes muttering seemingly to himself. We crossed the street, changed course, and he kept following about a half a block behind. Eventually I told her to keep walking and I turned around to confront him. Going from avoidance to confrontation was enough for him to break it off.
I should maybe add that I'm male, 41, and regularly attend Judo, Jiu Jitsu, and do a little kickboxing and am sometimes armed. I'm not Chuck Norris, or as young as I used to be, but I'm not completely helpless or unaccustomed to physical engagements. So this probably affects my demeanor and how I'm perceived.