I've realised it is happening because I've got the controls within a Repeating Section. At the time I created the template it seemed I had to put all the controls and fields within a repeating area to get them to bind correctly. I'm only ever expecting one row (if data exists) but when no data is returned of course the repeating section doesn't get populated. I think I need to put the controls onto the form outside of a repeating section.
Edit - what I really want is to show the data as not repeating. I'm only ever going to return one row if it exists.