Accidents can always happen, but we try to avoid such events from happening to us.
I use beaten up cheap looking camera bags, and I do not carry the camera openly. I keep the camera inside the camera bag until it is needed. I carry it with the lens pointing to the ground so that little can be seen of the front of the camera or the lens. I have insurance on the expensive photography items. It covers any loss at all. In case of a burglary, immediately report it to the local police department. Get a report (in any language). Then after you return home, contact your home insurance agent and report the theft. The insurance policy will cover documented burglaries as long as you have the police report.
The rest is luck.