Q:

Unbound local variables in a class definition are looked up in the global namespace - what does it mean?

The last paragraph of https://docs.python.org/3/reference/executionmodel.html#resolution-of-names says

Class definition blocks and arguments to exec() and eval() are special in the context of name resolution. A class definition is an executable statement that may use and define names. These references follow the normal rules for name resolution with an exception that unbound local variables are looked up in the global namespace. 

What does the last sentence of the quoted text mean? At first I inferred from it that the following code will print 1
a = 1

def foo():
    a = 2
    def bar():
        class Bar:
            b = a
        print(Bar.b)
    bar()

foo()

but I was wrong - a module consisting of the code above, when run, prints 2, i.e. the name a in the class definition, even though it's not bound in the class definition block and not bound in the local block just outside of it, isn't looked up in the global namespace, contrary to what the docs say.
I tried another code snippet described below (using a del statement, which is a construct that binds the variable in it)
a = 1

def foo():
    a = 2
    def bar():
        class Bar:
            del a
        print(Bar.b)
    bar()

foo()

but the del statement raises NameError: name 'a' is not defined.
So, I don't understand, what does that sentence mean?

A:

According to the docs,

if a name is bound in a block, it is a local variable of that block, unless declared as nonlocal or global.

In your first code block, a is not bound to anything in your class Bar definition, so it is not a local variable of that block.
One way of binding a name is by using it on the left-hand side of an assignment statement. Here's an example.
a = 1
def foo():
    a = 2
    class Bar:
        b = a
        a = 3
    print(Bar.b)
foo()

Result:
1

This demonstrates the principle of "unbound local variables are looked up in the global namespace" -- b = a uses the value of the global a rather than the value of the a local to foo.

In your second example, a is considered to be local to the class Bar block, because "A target occurring in a del statement is also considered bound" for the purpose of determining the scope of a name. But "unbound local variables are looked up in the global namespace" is not relevant, since del does not need to look up the value of the name in order to unbind it.
For good measure, we can experimentally confirm that a del statement signals to the interpreter that a name should be considered local. 
a = 1
def foo():
    a = 2
    class Bar:
        print(a)
        del a
foo()

Result:
1
Traceback (most recent call last):
  File "C:\Users\Kevin\Desktop\test.py", line 7, in <module>
    foo()
  File "C:\Users\Kevin\Desktop\test.py", line 4, in foo
    class Bar:
  File "C:\Users\Kevin\Desktop\test.py", line 6, in Bar
    del a
NameError: name 'a' is not defined

Here we see that print(a) successfully looks up the value of the local variable a, and then on the next line it crashes because del can't delete an unbound local variable.

A:

A local variable of a scope is any name defined anywhere in this scope. Notably, the variable itself is local, not the value assigned to it - a local variable can exist before or regardless of assignment.
>>> def foo():  # new function scope
...     a = 3    # local variable `a`
...     b: int   # local variable `b`
...     c = 3    # local variable `c`
...     del c
...     print(x)
...     x = 3    # local variable `x`
... foo()
UnboundLocalError: local variable 'x' referenced before assignment

An unbound local variable is such a local variable with no value bound to it. In the above example, all of b, c and x are unbound at some point.
Neither of your examples access an unbound local variable. Both lookup the name a, but never assign to it.

In a function block, referencing unbound local variables is an error, namely UnboundLocalError. It does not matter whether that name exists in an enclosing scope as well.
>>> x = 1
>>> def foo():
...     b = x  # local variable is looked up locally
...     x = 2  # make `x` a local variable
... foo()
UnboundLocalError: local variable 'x' referenced before assignment

In a class block, referencing unbound local variables falls back to a lookup in the global scope. This may or may not succeed.
>>> x = 1
>>> class Foo:
...     b = x  # local variable is looked up locally *or globally*
...     x = 2  # make `x` a local variable
... print(Foo.b, Foo.x)
1 2
>>> class Foo:
...     b = y  # local variable is looked up locally *or globally*
...     y = 2  # make `y` a local variable
... print(Foo.b, Foo.y)
NameError: name 'y' is not defined

