Per IRS Publication 17 Your Federal Income Tax, page 28:
Residency Test
To meet this test, your child must have lived with you for more than half the year. There are exceptions for temporary absences, children who were born or died during the year, kidnapped children, and children of divorced or separated parents.
Temporary absences. Your child is considered to have lived with you during periods of time when one of you, or both, are temporarily absent due to special circumstances such as: