This actually will work
get-spec is actually a function and will receive it's arguments evaluated. So here you are actually doing the same as `(s/get-spec 123)`. Instead, quote and qualify the symbol:
(s/get-spec 'user/foo)
or use syntax quote to take advantage of the fact that syntax quote resolves symbols automatically:
(s/get-spec `foo)
Needs to be qualified as above
Again, I think the key here though is that while this will work, it's not the expected way to use it. You can't declare a spec for a non-function var created via def. Or rather you can, but spec will ignore it in instrument and fail on check.
Where symbol-keyed specs is intended to be used is with functions:
(defn foo [x] (+ x 123))
(s/fdef foo :args int? :ret int?)
(s/form (s/get-spec `foo))
;;=> (clojure.spec.alpha/fspec :args clojure.core/int? :ret clojure.core/int? :fn nil)
;; also accepts key lookups for the function spec parts:
(s/form (:args (s/get-spec `foo)))
;;=> clojure.core/int?