Form 1042-S is used to report amounts paid to foreign persons (including persons presumed to be foreign) who are subject to income tax withholding. For an individual taxpayer, Form 1042-S is a document provided to you (and the IRS) by the payer of the income reported. That income could consist of interest, dividends, royalties, compensation for teaching, and a number of other income sources. See IRS Form 1042-S for a full list.
You should receive Form 1042-S even if no amount is deducted and withheld from the payment you received because of a treaty or exception to taxation, or if you repaid any amount to the payee.
Form 1042-S is also used to report amounts withheld under Chapter 3 of the Internal Revenue Code and to report distributions of effectively connected income by a publicly traded partnership or nominee.
Different rules may apply if you are a citizen of the United States or a resident alien; see IRS Publication 519 U.S. Tax Guide for Aliens for more information.