I only ignore them if they aren't close to me (except for one time lol). Like from across the street or something. Pretend like I didn't hear them lol
If they are in front of me, I am always very polite. I talk to them and then if they ask for my number or something, I say "no thanks" and then (If I am able to) hurry off like I have other important things to do.
I haven't really had any bad experiences. Like, none of them tried to harm me after I rejected or ignored them.