Inside buildings there are no problems.
Have the camera at sight at every time. Be aware of what is surrounding you (search specificly for people who is directly watching at you). Try not to be alone in streets.
Special caution in Madrid's central and tourist areas, mostly in Sol. Try not to catch people atention and not to look as a tourist. Do not accept anyone's too friendly help (they are probably trying to distract you). Do not let anyone touch you no matter the friendly they look. Have your camera well attached to you by the cords.
In less touristical places there is absolutely no problem. You may only find problems in open places as Puerta del Sol.
Anyway, these are only advices of common sense, this don't mean that you will have problems, it is just "in case of". The most probable is that you don't have any problems. By the way, I have been in most touristical places of my country without having any single problem.
It is just that in Madrid there is a specific southamerican mafia which usually targets japanese tourists (who are very inocent and carry always expensive camera devices) and that operates in the town center.
Regards, good luck, and don't be afraid
Enjoy!
Fernando