The easist way to keep a magnet from sticking to other stuff is to keep
it away from the other stuff. The forces of attraction and repulsion
get very small far away from the magnet.
You can also redirect the magnetic flux lines into a loop to
reduce the field strength away from the magnet. The easist way to do
this is to put a bar of iron (like a nail) across the two poles of a
horseshoe magnet. That way most of the magnetic field lines go through
the nail and don't go out into the nearby space, keeping other stuff
from being pulled in.
You can make magnetic shielding material out of a variety of
stuff. Mu-metal is a special alloy that allows magnetic field lines to
travel very easily through it, acting like the nail in the above
Superconductors are also very good magnetic shields. Many
superconductors (called Type I) do not permit magnetic fields to exist
inside them. Put your magnet inside a superconducting box and no field
lines will escape. Careful, though, because superconducting materials
won't superconduct as easily (read: you have to get them even colder,
or sometimes they won't work at all) when there's a magnet around.
Here's a way you can do it but it'll wreck your magnet: Heat up
the magnet. It'll demagnetize and not attract stuff. It might magnetize
a little again when cooled off, though.
(republished on 07/13/06)