You probably meant
//*[local-name()='a'][*[local-name()='aCode']='aaa']
This one work:
//*[local-name()='a'][*[local-name()='acode' and text()='a2']]
and also this one:
//*[local-name()='a'][aCode[text()='a2']]
Try this
/a/aCode[text()='aaa']
or
//*[local-name() = 'aCode' and text() = 'aaa']
You have used //
at wrong place.