Telekinesis' violent thrust option to hurl something really big at them. Or a bunch of little things that were made that way via shrink item.
Polmorph a dragon into gecko. Then carry him around in a portable terrarrium that is sealed so he can't escape. When someone attacks you with an AMF up, throw the container and teleport away.
If you are a pure spellcaster, your best defense against AMF is likely to be a contingency to teleport you away as soon as one gets near you. Then scry on the bastards via greater scrying for a while and come back once the field is dropped.
One of the best defenses against AMF for a wizard is to have some friends around that can stomp some serious butt. Barring special circumstances, the things that can cast AMF are generall not exceptional fighters (i.e. high level wizards).