Tax Reform Update: Personal exemptions are suspended for tax years 2018-2025.
Per IRS Publication 17 Your Federal Income Tax (For Individuals), page 26:
If the child meets the rules to be a qualifying child of more than one person, only one person can actually treat the child as a qualifying child.
Page 32: Relatives who don't have to live with you. A person related to you in any of the following ways doesn't have to live with you all year as a member of your household to meet this test.
Any of these relationships that were established by marriage aren't ended by death or divorce.
Foster child. A foster child is an individual who is placed with you by an authorized placement agency or by judgment, decree, or other order of any court of competent jurisdiction.
You may also wish to utilize the IRS Interactive Tax Assistant (ITA) topic Who can I claim as a dependent?