I have never been robbed while traveling, but some precautions and awareness developed from working in NY City for years probably lessened the risk.
One is that for over 20 years of non-USA travel, I have used a neck held cloth pouch for excess money, passport, travelers checks, credit cards, drivers license and other id documents. I just keep my hotel key, some change, maybe some 'mugger money', a small notebook and a pen in my pockets. This reduces the risk being a victim of pickpockets. If you do carry a wallet in your pocket, put a wide rubberband around it and keep it deep in a side pocket or at least in a buttoned pocket. Second, is to have a good map of the area you are visiting and orientate yourself well. This will make you less of a target and to avoid high risk areas. Third, avoid high risk beheavors, including being alone and getting drunk, using drugs, being out in shady areas and especially at 2 am. Four, keep your camera and other like items in a day hike pack and take them out of it only as needed. Five, be aware of your surrondings. Look around not just up at the buildings or that hot babe walking by but also behind you once in a while for potential trouble makers. Realize that trains, public transport where close contact with others are very high risk area for pickpockets.