MS SQL DB design help
The inner part you can create like this

DECLARE @table TABLE(Lookup_item_id INT, code VARCHAR(100),lookup_item_title VARCHAR(100));
INSERT INTO @table  VALUES
 (220,'ad_flat.installations','Town gas')
,(221,'ad_flat.installations','City water')
,(224,'ad_flat.heating_type','gas')
,(226,'ad_flat.heating_type','wood');

SELECT t.code AS [@code]
      ,t.Lookup_item_id AS [*] 
FROM @table AS t
FOR XML PATH('lookup_item'),ROOT('lookup_list');


The result

&lt;lookup_list&gt;
  &lt;lookup_item code="ad_flat.installations"&gt;220&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.installations"&gt;221&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.heating_type"&gt;224&lt;/lookup_item&gt;
  &lt;lookup_item code="ad_flat.heating_type"&gt;226&lt;/lookup_item&gt;
&lt;/lookup_list&gt;


This you can integrate into your select within paranthesis like a column (scalar sub-select).