How does Apple know which passwords never to be saved?
It saves the site for which you don't want to save the password, not the password itself.
You can see the sites at:
Safari->Preferences->Passwords