Query for tasks in namespace

I do SQL for a living, but in spite (or maybe because) of that I’m having a hard time wrapping my head around Logseq’s queries.

I’ll start with this. I’m trying to find all pages in my project namespace with active tasks. I can get this far:

:query [
:find (pull ?p [*])
:where 
[?b :block/marker ?t]
[(contains? #{"TODO", "DOING", "WAITING"}, ?t)]
[?b :block/page ?p]
[?p :block/namespace ?ns]
[?ns :block/name ?nsn]
]}

but I’m stuck limiting the results to pages in the right name space. For instance

:query [
:find (pull ?p [*])
:where 
[?b :block/marker ?t]
[(contains? #{"TODO", "DOING", "WAITING"}, ?t)]
[?b :block/page ?p]
[?p :block/namespace ?ns]
[?ns :block/name ?nsn]
[(contains? #{"project"} ?nsn)]
]}

returns no matches.