In general, we deal with the most random stuff that we don't want our dogs to be getting into while out on dog walks so it's also the best place to start training. Grab some treats or a toy before you leave the house then wait for your dog to be distracted by something. When the dog is distracted and wants to go check something undesirable out, firmly state "leave it" then distract them with the reward.
Petfinder details a more intensive version which involves several layers of training in the process of rewarding with the distraction along with some progressive stages. Another thing to consider is that they are defining the command as simply not picking up whatever it is the dog wants rather than completely not going near it.
Here's an interesting clicker training version from Youtube