In a "bad" part of town, maybe think of the people there as real people, and don't come across as obviously fearful. This has worked pretty well for me (although there are certainly other factors involved).
Maybe, and maybe get mugged. But I don't want to get mugged.
Sure on an intellectual level, everyone is a human being, deserves to be heard, not feared, etc, etc.
At night, in a neighborhood ridden with crime, seeing a bunch of teenagers zoom on your from across the street and starting to cross the street toward you, it is easy to re-assess some priorities.
Y'know, people who want to steal for a living usually learn very quickly how to tell if you're gonna fight back. They don't want a fight, they want your money.
If you look like you'll bolt the moment you're threatened, that's a better outcome. Better than being stabbed or shot, at least.
If appearing obviously fearful is enough to significantly increase the chances of people hassling you it's a pretty good indicator that you're in a bad part of town.
Oh they are certainly real people. Real people who will beat and rob you for $3. That's just how people can be at their basest level. Communication and charity doesn't go very far on that plane of interaction. Of course if you are in that part of town as a "customer" than it's different....