I've definitely done that, and afterwards my boss was approving. (I just leave, no need to say why at the time.)
But we've worked together for several years, so he trusts my judgment.