return 'undefined' if last elem in path is not present 
in doc, matching javascript object behavior.