Hi,
The scenario is not clear to me. Please clarify
You speak about DACPAC but you selected the tag transact-sql which make no sense. DACPAC si created using a utilities and it is not related to executing queries directly.
If you have XML which you need to parse and remove/add/edit the content with transact-sql then please provide a sample data so we will have something to descuss and present the result of the XML which you want the query to return
If you are speaking about removing object from DACPAC , then :
Option 1: You can create bacpac instead of dacpac
When you sue SSMS and execute the utility to create dacpac then you do not have option to select which object are added to the package but when you create bacpac file then you can select exactly which object to add
In this case, you can remove the unneeded files from the bacpac package and do tiny editing and re-package it as dacpac, or simply use it directly as bacpac
Option 2: after you create the dacpac, open the package and edit the file manually. In this case, you can use notpad++ or any XML parser. In fact, you can also load the file to SQL Server and use queries to edit the content but this is a bit like Kill a mosquito with a cannon
Several days ago I publish an image on Facebook, which explain the differences between bacpac and dacpac. The image include two QR code to recordings (one is in Hebrew and one in English) of my lecture about the internals of the bacpac and how to edit these if you have issue (like a feature which is not supported in the target server). I HIGHLY recommend to check the recording
https://www.facebook.com/ronen.ariely/posts/1720241498182294