Whether you are in your hometown, your state or nation's capital, or a foreign city, there are few simple rules to follow to ensure your safety. Most experienced travelers know these rules, follow them, and have no troubles.
rule #1 - don't be a target for crime.
Don't flaunt your wealth. If you have to go some place where you will be around people who are less well off than you are, you shouldn't do anything to look out of place - that is, looking like you have money. Simple.
If you want to become a crime statistic, put on your best clothing, most expensive jewelry, and carry some expensive equipment visibily on your person - like a fancy mobile phone, camera, etc. - and walk around the seediest area of town (the "poor side") in any major city on the planet (except perhaps Japan). Even better, go there at night, alone. What are your chances of getting mugged? Pretty good, we'll bet
rule #2: don't look like a tourist.
You've seen the funny cartoons about American Tourists. Unfortunately, they happen to have a lot of truth to them. If you have lived or traveled extensively overseas, you have learned to spot American tourists easily. Here are some of the taletell signs:
- Americans are often overweight.
- They wear T-shirts, and sometimes shorts.
- They wear hats - usually baseball caps - even while eating in a restaurant, indoors.
- They wear tennis shoes or sandals.
While these types of clothing may be "practical," wearing them also draws attention (and in some countries, disdain).
Looking like a tourist will attract pickpockets and other criminal types. Remember, you are an ambassador of whatever country you come from. What you wear and how you act in public can leave (or reinforce) a negative impression. Don't dress like a slob or act an idiot. We all pay the price.
enjoy yourself

If you are vacationing at a beach resort - then by all means, go ahead and enjoy yourself and dress like this if you want to - it is likely everyone around you will be doing the same (that's why it's ok!)
In summary
Dress like the locals do, try to avoid areas with many tourists, and you will have few problems.