There's new rules for claiming dependents. Under the new rules, a dependent must meet either the qualifying child or the qualifying relative tests.
There's one big complication, however. If any taxpayer could claim the dependent under the qualifying child rules, then no other taxpayer may claim the dependent under the qualifying relative rules. H&R Block director Kathy Burlison phrased it this way, "Once a qualifying child, always a qualifying child, and never a qualifying relative."
Here's how it would work out in your scenario.
Your daughter is the qualifying child of your ex-wife. Why? Under the new rules for qualifying child, the dependent must live with the taxpayer for more than half the year. Since your daughter lived with her mom all year, her mom would be able to claim the daughter as a dependent under the qualifying child rules.
The child also lived with the boyfriend all year. However, the boyfriend does not meet the relationship test for the qualifying child rules. The relationship test specifies that the dependent must be the taxpayer's child, step child, adopted child, foster child, brother or sister, or descendent of one of these relationships. The boyfriend is not related to your daughter by blood, marriage, or legal guardianship.
Both you as the father and the boyfriend could possibly claim the dependent under the qualifying relative rules. They key to understanding qualifying relative is finding out if there's a mandatory residency requirement or not. For you as the father, there's no residency requirement. So you could claim your daughter even if she didn't live with you. For the boyfriend, he could claim your daughter if the daughter lived with him for an entire calendar year (January 1 - December 31).
However, neither you nor the boyfriend can claim the daughter. That's because the qualifying child rules always trumps the qualifying relative rules. Since your ex-wife meets the criteria to claim your daughter, then no one else gets to claim the daughter. Even if other people would otherwise meet the tests.
So even if your ex-wife isn't going to file a return, under these new tax laws you and the boyfriend are not eligible to claim your daughter as a dependent.