This comes up fairly frequently...long enough for a HOWTO? I guess I'll see
Let's say you want to open an administrative program like gparted, which needs to run as root. You type su -c 'gparted' at the prompt and get a mysterious error about denial of access to root, of all users!
First, run xhost +si:localuser:root under your X session without su, i.e., as a normal user. Then, run your root program with su/sudo. It should work fine. Afterwards, you may want to circumscribe root access again. In this case, do: xhost -si:localuser:root as a normal user.
This process can logically apply to other user accounts, substituting other usernames where root is supplied above (and, yes, su can promote your shell to other users than root; see the manual page for further information)