How magnetic invisibility works