This is my sample code and its output.
/usr/include/c++/4.9/new:129:41: error: 'void* AAA::operator new(AAA::std::size_t)' may not be declared within a namespace
Yes, this operator must be at global scope. It is "special".
[C++14: 126.96.36.199/1]:An allocation function shall be a class member function or a global function; a program is ill-formed if an allocation function is declared in a namespace scope other than global scope or declared static in global scope. [..]
And, yes, standard library headers must be
#included in "free space":
[C++14: 188.8.131.52/3]:A translation unit shall include a header only outside of any external declaration or definition, and shall include the header lexically before the first reference in that translation unit to any of the entities declared in that header. No diagnostic is required.