Query blocks without an specific tag

Hi, please help me with the following example.
I want to get all task DOING, but I want to leave apart any task that have a reference to books page (:closed_book:).
Its easy to get all tasks that make reference to books, but just using a not clause will retrieve any task with any reference to a page that is not :closed_book:, even if other tag in the same block makes reference to :closed_book:.
Sorry if Iā€™m not explaining well, english is a bit intrincated question and english is not my main language. Thanks!

#+BEGIN_QUERY
{
  :query [
    :find (pull ?b [*])
    :where
    (task ?b #{"DOING"})
    [?badRef :block/name "šŸ“•"]
    [?b :block/refs ?refs]
    [(not (contains? ?refs ?badRef))]
  ]
}
#+END_QUERY

Something like this:

#+BEGIN_QUERY
{
  :query [
    :find (pull ?b [*])
    :where
      (task ?b #{"DOING"})
      [?badRef :block/name "šŸ“•"]
      (not [?b :block/refs ?badRef])
  ]
}
#+END_QUERY

This is working great, thank you!

Can I ask you a little twist? Its possible to ignore all tasks in a map #{} ? Thanks!

Do you mean this?

#+BEGIN_QUERY
{
  :query [
    :find (pull ?b [*])
    :where
      (task ?b #{"DOING"})
      (not
        [?b :block/refs ?badRef]
        [?badRef :block/name ?badName]
        [(contains? #{"šŸ“•" ...} ?badName)]
      )
  ]
}
#+END_QUERY

Just managed to do this using this (I have an input with the ignored map)

(not-join [?b ?ignore]
                    [?b :block/refs ?ref]
                    [?ref :block/name ?name]
                    [(contains? ?ignore ?name)]
                  )

But I think your response is more clear and works well for me also. Where did you learn these things? Thank you very much!