how to prevent music on iPhone from automatically syncing songs to iTunes

Plug her phone back into iTunes. In iTunes, click on her iphone, and in Options uncheck anything having to do with "Syncing Automatically". If it's not already checked, click "Manually manage music and videos".

If you want her to have a separate iTunes library, she should also have a separate login for the shared computer. This is really the easiest way to deal anything on a shared computer.

Incidentally, there shouldn't really be any reason to physically plug your iPhone into your computer anymore. You can actually set the phone (and iPads, etc) to sync wirelessly.