The danger you face on a bicycle is from motorized vehicles. You're not going to get mugged on a bike during the daytime unless you are very unwise. Ride a bike that isn't obviously valuable, don't wear fluorescent colors, don't stop to sightsee, don't stop for conversations, and don't expect your lock to help you if leave your bike unattended. In poor areas riding a bike is an indicator that you are poor or that you have lost your driver's license (which is another indicator that you are poor). As long as you don't contradict that impression you'll be fine.
For instance, when I lived near LA I would regularly bike all over, including through areas such as Compton.
I can't do that. The 'unknown' parts of my city are unknown for a reason...