Even if the other dependency tests are met, you are not allowed an exemption for your dependent if he or she files a joint return. (Exemptions are no longer available starting with the 2018 tax year)
Joint Return Test
You generally can't claim a married person as a dependent if he or she files a joint return.
Exception.
Example 1—child files joint return.
Example 2—child files joint return only as claim for refund of withheld tax.
Example 3—child files joint return to claim American opportunity credit.