I am aware of the earlier discussions about the XML declaration (see link below). However, it is still a pitty that this facility is still not available, which makes it for some uses very annoying to manually include the <?xml version="1.0"?> in top every time. In exploring for an alternative for Kompozer I came across AbiWord. Although this is not an XHTML editor, it supports XHTML very well and their solution for the headers could be a good solution for Kompozer also. What they do is to ask the user with a check box in the save window whether the xml declaration should be added or not. In this case, the current behaviour of Kompozer could be te same (including the deletion of the XML declaration during editing), and each time during save it is added again (or not).
A maybe even better option is to configure a header in a configuration file that could at save time replace all headers above <html>. With some applications I also have to remove (strangely enough) the Kompozer DOCTYPE declaration for XHTML.