We have seen several times starfleet officers beaming aboard Borg vessels and do their thing. As long as they are not a threat. The Borg only assimilate things that are worthy of assimilating. To my understanding anti-matter warheads cannot be transported with the transporter, but nuclear warheads could have (nukes don't use anti-matter). Now take the Tsar Bomba. That nuke was detonated 400 years earlier. But it generated a fireball of 8km in size. A Borg ship would never survive such an explosion. And you don't even need a Tsar Bomba like nuke to destroy the Borg Cube. A much smaller nuclear explosion would do the trick.
Borg vessels do in fact have shields normally they are down which allows Starfleet personnel to beam onto the vessel for whatever they want to do however during tactical maneuvers shields would undoubtedly be raised
On Voyager they did beam an explosive onto a Borg vessel however it was explicitly stated that the Borg were re configuring their shield array at the time
Furthermore to transport, a vessel has to drop its shields which is not a good idea when your encountering the Borg or in any battle situation really
A final point is while it may work once on a vessel that is not actively engaging a Federation ship the Borg would likely adapt to the tactic
The torpedo from Voyager for example was detected the second it appeared and only succeeded because the Borg tried to disarm it instead of immediately transporting it off their ship