Query which excludes tasks under set of namespaces

Hello,
I use one graph for several facets of life (work, home, volunteer, …). I have also set up a task dashboard for each facet with queries to manage related tasks.

Example:

		:title [:h3 "🧯 Tasks/Home NOW"]
		:inputs ["now" "t-home"]
		;; ---- inspiration: https://adxsoft.github.io/logseqadvancedquerybuilder/
		;; ---- Get every block into variable ?block
		:query [:find (pull ?block [*])
			:in $ ?tag1 ?tag2
			;; ---- filter command
			:where
			;; ---- limit search to blocks that contain uncompleted task markers
				[?block :block/marker ?marker]
				[(contains? #{"NOW" "LATER" "TODO" "DOING"} ?marker)]
			;; ---- get block content into variable ?blockcontent
				[?block :block/content ?blockcontent]
			;; ---- get page (special type of block) into variable ?page (used later)
				[?block :block/page ?page]
			;; ---- get page name (lowercase) from the page block into variable ?pagename
				[?page :block/name ?pagename]
				( and
					;; ---- Select block if it has all the following tags or page links
					(page-ref ?block ?tag1)
					(page-ref ?block ?tag2)
				)
		]
		:result-transform (fn [result] (sort-by (fn [r] (get-in r [:block/page :block/journal-day])) result))  ; Sort by the journal date
		:table-view? false
		:breadcrumb-show? false
		:collapsed? false
	}

I would like to replace the t-{facet} inclusion criterion with an exclusion criterion that takes a list of namespaces and ignores any tasks found within. I have searched through the discussion threads, the documentation and in the web, and have spent many hours reading and trying to this myself, but I’m not getting anywhere.

Thank you for any help.

Something like this:

(not
  [?page :block/namespace ?ns]
  [?ns :block/name ?ns-name]
  [(contains? #{"name1" "name2"} ?ns-name)]
)

For multi-level namespaces, line [?page :block/namespace ?ns] can be replaced with a recursive rule, like in TODOs from parent and child pages