This can be done on the client or server side using MessageFormatter. You can also change this with MessageEncoder, but this has a lot of problems.
This article describes how to do this on the server side using MessageFormatter, as well as the reverse side of MessageEncoder:
http://vanacosmin.ro/Articles/Read/WCFEnvelopeNamespacePrefix
What you need to do is apply the MessageFormatter client side (possibly using ApplyClientBehavior instead of ApplyDispatchBehavior). In addition, in a custom message class, you need to add your namespace as an attribute with the prefix "foo" (in the OnWriteStartEnvelope method).
Unfortunately, there is no easy way (for example, applying some attributes) that will make the necessary changes.
source share