I see. Yes, I just tried this and got the same results. It seems this is happening because InfoPath sends the command
set implicit_transactions on
before your query. Then the DELETE is considered an implicit transaction, and InfoPath sends the command:
IF @@TRANCOUNT > 0 ROLLBACK TRAN
Which rolls back your command.
I've found that you can get around this by turning implicit_transactions off, so please try this:
XDocument.QueryAdapter.Command = "set implicit_transactions off delete dbo.Table where valueId = 5; ";