Yes, if you did not pay tax on this income in Germany, then this would be excluded from the income that was taxed by your foreign country of residence. Here is more clarification:
Line 1a - Gross income from sources within (foreign) country - even if this income is not taxed in the foreign country. Don't include any earned income excluded on Form 2555, Foreign Earned Income, or Form 2555-EZ, Foreign Earned Income Exclusion.
Line 3d - Enter your gross foreign source income from the category you checked above Part I of this Form 1116. Include any foreign earned income you have excluded on Form 2555 or Form 2555-EZ but don't include any other exempt income.
Line 3e - Enter in each column your gross income from all sources and all categories, both U.S. and foreign. Include any foreign earned income you have excluded on Form 2555 or Form 2555-EZ but don't include any other exempt income.
Remember, this form is used to receive a credit for any foreign taxes paid. Therefore, you will report all worldwide income on your US tax return and use Form 1116 to report any taxes paid on your income to Germany. The tax credit you receive prevents double taxation.
Click this IRS link for more information as additional rules apply to nonresident aliens: https://www.irs.gov/pub/irs-pdf/i1116.pdf.
I am still confused however, because of a correction that the IRS made to our return a couple of years ago.
I had entered on line 16b of Form 1040 the taxable part of my pension from a US state and on line 20b the calculated taxable part of my husband's US social security benefit. Together with a German pension, which was taxed here in Germany, this made up the total income on line 22, which was also entered on Form 1116, line 2e, as the gross income from all sources.
The IRS later sent a check and explained that I had made an error and directed me to Publication 915, where I read "U.S. citizens who are residents of the following countries are exempt from U.S. tax on their benefits. Canada. Egypt. Germany. Ireland. Israel. Italy. (You must also be a citizen of Italy for the exemption to apply.) Romania. United Kingdom. The SSA will not withhold U.S. tax."
The difference between their calculation of our adjusted gross income, line 37, and ours was exactly the amount that I had entered on line 20b, which confirmed to me that the whole of the US Social Security income was not taxable by the US.
However, the IRS made no adjustment to my calculation of the foreign tax credit, which had included most of the US Social Security benefit in the gross income from all sources on line 2e, therefore my question.
I hope I've been clearer. Thanks again.
PPS Neither of us is an IRS-defined nonresident alien.
With apologies for wordiness.