This check does not support variables with different namespaces in the scope of a function.
This test case should produce unused variable for $z:x but it doesn't:
declare namespace z = 'zzz';
declare function local:x() {
	let $local:x := 'z'
	let $z:x := 'z'
	return $local:x
};
local:x()