How do you negotiate who gets to use their bomb for this? Whoever does it basically gets a free nuclear test that the other nuclear powers would probably be jealous of, but those same nuclear powers might also worry that their own bomb test, if they were permitted one test as compensation, might not go off without a hitch. They might therefore wish for there to be no nuclear detonations at all, to avoid the risk of being embarrassed. Furthermore there's also the issue of launch vehicle; some nuclear powers are more experienced with deep space missions than others, but fitting one country's bomb to another rocket may not be politically possible. America, maybe China, Russia or India could do it. The UK or France putting a nuke on an ESA rocket seems questionable. Pakistan and the other nuclear powers probably lack the requisite launch vehicle entirely but might publicly assert that the whole thing is a sham to violate the test / space weaponization bans.
Russia already pulled out of the nuclear test ban treaty, they have no leverage over the West getting "a free nuclear test" anymore, and anyway, all that the country doing the launch needs to do is show the trajectory estimation data.
The only countries truly capable of something like this within the next couple of decades would be the US or China anyway. So only their opinion really matters and both of them would likely just complain for appearances but not actually seriously oppose the action.
Anyone else doing the complaining is just looking for any excuse to pull out of the test ban treaty and should just be threatened with heavy sanctions if they do (as they would, even without a dangerous asteroid bearing down on Earth).