As long as you leave the ground leg of the UPS connected, sure. Don't just yank the cord out of the wall, as that can have unexpected and sometimes disastrous consequences. A large percentage of the time people get away with it, but if it bites you, it bites big.
Remove power to the circuit without unplugging, that way all the connected equipment still has a common ground reference. Tripping the breaker, turning off the outlet, whatever, as long as the cord is still plugged in.