I've traveled alone to some real shitholes in this world and never felt unsafe. Nevertheless, some time ago a former employer insisted that I receive formal training in travel safety, and I picked up some useful tips. These are particularly relevant for conflict areas, but I use them on most trips.
*choose rooms between 4th and 7th floor. Lower floors are more at risk for everything from bomb damage to criminal invasion, but go too high and fire truck ladders can't reach you.
*choose rooms that face the back of the hotel and as far away from the lobby as possible. Everyone likes a nice view, but car bombs usually detonate in front of the building. I had stayed at the Taj hotel in Mumbai just a few months before the terrorist attack there. Trust me, the back is less glamorous but a lot safer.
*lock your current passport in the safe and carry an expired passport with you at all times. If your purse/backpack is stolen, no big deal. But if civil war or natural disaster strikes and you can't reach the hotel, an expired passport will still prove your citizenship and get you into the embassy.
*don't assume you and your purse/backpack will stay together if something really bad happens. Put scanned copies of important documents - like your passport, medications, allergies, and contacts at home - on a USB drive that can hang from a lanyard around your neck and under your shirt. Medical information is crucial. If there is an emergency and you are unconscious, the USB will be found by first responders.
*count the steps between your hotel room front door and the nearest emergency exit. If the hallways are dark or full of smoke you will still find your way out.
*buy a penlight or small flashlight and check batteries before each trip. I carry a tiny 3-inch tactical light with me at all times and leave another in the hotel room by the bed. Bonus points for also having a laser pointer and whistle. I haven't gone that far yet.