The relevant documentation is IRS Pub 970. As usual however, you have to do quite a bit of digging to find clear answers.
In general, there are three cases when withdrawing money from a 529 plan:
- Withdraw money to pay for qualified education expenses. (No tax)
- Withdraw money without any qualified expenses to match. (Pay income tax +10% penalty on earnings)
- Withdraw money equal to the amount of tax-free education assistance, usually this is a scholarship. (Pay only income tax on earnings).
The big sticking point is "double-dipping", which the IRS calls "double-benefit". If a qualified education expense is paid out of tax-free money (regardless of its source), then you cannot also make a tax-free distribution (situation 1 above) from the 529.
The 10% penalty applies in all situations where you make a taxable withdrawal except:
A tax-free scholarship or fellowship grant (see Tax-Free Scholarships and Fellowship Grants in chapter 1);
...
Employer-provided educational assistance (see chapter 11 );
(Emphasis mine, quoted from "Additional Tax on Taxable Distributions" section under QTP)
So the short answer for your situations is "No", the 10% does not apply. Whatever you do, just make sure you're not "double-dipping".