If some of the targets become illegal for Kuldotha Flamefiend's ability, the original division of damage still applies, but the damage that would have been dealt to illegal targets isn't dealt at all. If all of the targets become illegal, you can't sacrifice an artifact.