If you offboard the shared mailbox back to on-prem, then remove the Azure object and resync with AADConnect, that would work and clean that up.
This assumes its not licensed and not using OneDrive etc...
Once the mailbox is moved on-prem, run this using connect-msolservice against the Azure sycned object to remove it
https://learn.microsoft.com/en-us/powershell/module/msonline/connect-msolservice?view=azureadps-1.0
https://learn.microsoft.com/en-us/powershell/module/msonline/remove-msoluser?view=azureadps-1.0
Remove-MsolUser -UserPrincipalName "sharedmailbox@contoso.com"
Followed by:
Remove-MsolUser -UserPrincipalName "sharedmailbox@contoso.com" -RemoveFromRecycleBin
Then Resync the object from on-prem and move the mailbox back to 365.