Alot will depend on whether or not you have only one account on your machine e.g an admin account. If you do I haven't run any of the following by using just the one account. I have 2. A general user account and an admin one which I have used to correct the problem for the general user. I'll do my best to help, though I can't be held responsible for any issues arising from this. It worked for me but may not work for you.
Firstly make sure you have a backup of you machine in case anything goes wrong. At a minimum you should have a backup of all the files in the iTunes folder (not folders).
Make sure iTunes is shut down and then delete all but the latest tmp file from the iTunes folder. This should leave you with one tmp file of roughly the same size as the iTunes Music Library.xml file. You can skip this step if worried and tidy up later but be sure to make a note of the name of the latest tmp file. You'll need it later.
Be sure whichever account you are using has write access to the iTunes folder. You can do this in finder by using 'Get Info' on the folder and adding the administrator user as necessary in the access list at the bottom of the screen. Again be sure its got write access.
Now launch terminal.
Within terminal issue the following commands :-
Where xxxxx is user ID of account with issue
i) cd /Users/xxxxx/Music/iTunes
ii) rm "iTunes Music Library.xml"
You'll get a message re overriding the file right - type y to override
Where Temp File.tmp is the name of the latest tmp file
iii) mv Temp File.tmp iTunes Music Library.xml
iv) exit
Now close terminal
The above commands will remove the problem file and rename the tmp file to be correct. If you check the iTunes folder hopefully you'll see the tmp file has disappeared and a brand new iTunes Music Library.xml is there.
You can run a repair disk permissions using Disk Utility at this stage if you wish. Never harms to do this regularly anyway.
You can now check the rights of the iTunes Music Library.xml in the iTunes folder using 'Get Info' this should now show that the account holder of the iTunes library had write access.
Launch iTunes if all is OK and then monitor the iTunes folder. You should see tmp files come and go normally whilst using iTunes but the tmp file issue should have disappeared. If it ever reoccurs then just follow the steps again,
Good Luck.