Since `id -Gn` output is space delimited, you can't use that.
The GNU implementation of `id` since coreutils 8.22 has a `-z` option to output the list nul-delimited instead of space-delimited, so you could do (with GNU `grep` which you seem to be using already):
id -Gzn username | grep -Fxz 'mydomain\staff'
Or:
id -Gzn username | grep -z '\\staff$'
For `staff` in any _domain_ (whatever that is).
Otherwise, if you have a `getent` command, you could take the problem in reverse:
staff_members=$(getent group 'mydomain\staff' | cut -d : -f 4-)
case ",$staff_members," in
(*,username,*) printf '%s\
' 'username is member of mydomain\staff'
esac