When started doing consulting work for Grupo Planeta in March, they asked that I provide a tax certificate to prove that I paid taxes in the United States. Spain and the U.S. have a treaty which allows citizens to pay all of their taxes in their own country as long as they can provide proof that they pay taxes. If not, an automatic tax deduction of 25% taken by the Spanish government and you are still taxed fully on the earnings by the IRS.
I started doing Google searches on "tax certificates" and "doing business in Spain," without any real hits that explained what I needed. I asked my accountant to do some checking and he also was initially unaware of anything special.
The folks at Planeta were very patient and provided a sample of what they were looking for.
With this in hand, I made a trip to the local IRS office in Milwaukee. I met a great person there, handed him the sample letter and the 15 year veteran said, "I have never seen anything like this before."
More searching and two lawyers eventually lead me to the answer.
Should you ever find yourself in this situation in Spain or one of the 65 other countries with which the U.S. has similar agreements, you need to fill out IRS Form 8802 – Application for United States Residency Certification (Instructions/Form). This application is the formal request for a Form 6166 from the IRS. The letter above is the 6166 that you will receive. The 8802 is a simple three page form to fill out. You can request letters for multiple countries all at once and it cost $35. And FYI – the 6166 needs to be requested and provided to your clients every year that you conduct business with them.
Hope this helps others in the same situation.