2.2. Using namespaces

All namespaces referred from the data objects must be declared in the header of X-definition. (Note that the "default" namespace without prefix may be also used. However, it's not recommended - you should rather specify all namespaces with a prefix.)

<xd:def xmlns:xd = "http://www.xdef.org/xdef/4.2"
        xmlns:bk = "http://www.book.com"
        xd:name = "Books" xd:root = "bk:Inventory" >

     <bk:book xd:xcript = "occurs *"
              isbn      = "num(10);" >
        <bk:publisher> string();  </bk:publisher>
        <bk:year>      gYear();   </bk:year>
        <bk:price>     decimal(); </bk:price>
        <bk:author xd:script="occurs *"> string(); </bk:author>
        <bk:title>     string();  </bk:title>

You can try it HERE