SQL server changes XML structure when inserted
You can use xml:space = "preserve" on the nodes where you want to keep the space. Using xml:space is "only a signal of intent" but SQL server is kind to us here.

For one node

declare @X xml =
'&lt;root&gt;
  &lt;element xml:space = "preserve"&gt; &lt;/element&gt;
  &lt;element&gt; &lt;/element&gt;
&lt;/root&gt;'

select @X;


Result:

&lt;root&gt;
  &lt;element xml:space="preserve"&gt; &lt;/element&gt;
  &lt;element /&gt;
&lt;/root&gt;


Entire document:

declare @X xml =
'&lt;root xml:space = "preserve"&gt;
  &lt;element&gt; &lt;/element&gt;
  &lt;element&gt; &lt;/element&gt;
&lt;/root&gt;'

select @X;


Result:

&lt;root xml:space="preserve"&gt;
  &lt;element&gt; &lt;/element&gt;
  &lt;element&gt; &lt;/element&gt;
&lt;/root&gt;


Another options for the entire document is to use convert with style 1.


  Preserve insignificant white space. This style setting sets the
  default xml:space handling to match the behavior of
  xml:space="preserve".


declare @X xml = convert(xml, 
'&lt;root&gt;
  &lt;element&gt; &lt;/element&gt;
  &lt;element&gt; &lt;/element&gt;
&lt;/root&gt;', 1)

select @X;