Risolto facendo così:
"DELETE FROM tab_msg WHERE tab_msg.id NOT IN (SELECT id_msg FROM tab_msg_user)"