A map might contain all qualified keyword keys from a certain namespace, or it may contain a mix of unqualified keys or qualified keys from multiple namespaces. Here's a function to get the set of all namespaces (as keywords) from qualified keyword keys in a map:
(defn key-namespaces
"Returns set of all namespaces of keys in m."
[m]
(->> (keys m)
(keep (comp keyword namespace))
(set)))
Now you can use that as a dispatch-fn
on a multimethod:
(defmulti do-thing key-namespaces)
(defmethod do-thing #{:foo} [m] (prn m))
(do-thing #:foo{:bar 1})
;; #:foo{:bar 1}
(foo {:bar/bar 1})
;; no multimethod found exception
You could specify multiple namespace prefixes in that set, or you could use a different dispatch-fn
based on your use case.