Kirk Allen Evans gives an example how to generate a base64 encoded WordML binData element. Just for kicks, here is how the same code would look like in SQL Server 2005 using FOR XML (as in his case, it is not the complete Word document):
Oh the joy of declarative programming :-). Here is how you can extract the value (assuming the XML with the base64 encoded value was in a T-SQL variable @x):
Note that the value() method will automatically base64 decode (or also hex decode, if the binary value was of type xs:hexBinary) if the target SQL type is a binary type.