I looked for a way without redefining the function and not using explicit knowledge about it (so it can be generalized)
pl[f_, lims_] := Module[{eps = 0.05},
Off[InverseFunction::"ifun"];
Print@Plot[f[u], {u, lims[[1]], lims[[2]]},
Exclusions ->
{{f[u] == f[InverseFunction[f][u]], Abs[(f[u] - f[u + eps])] > 10 eps},
{f[u] == f[InverseFunction[f][u]], Abs[(f[u] - f[u - eps])] > 10 eps}}]
On[InverseFunction::"ifun"];
];
(* Testing *)
f[x_] := If[2 < x < 3, 0, x];
pl[f, {0, 5}];
pl[Tan, {0, 2 Pi}]

Edit
Ok, this one does not use InverseFunction, and identifies discontinuities, as far as I tested it:
(*Function Definition*)
pl[f_, lims_]:= Plot[f[u],{u, lims[[1]], lims[[2]]},Exclusions->{True, f[u] == 1}];
(*--------Test--------*)
flist = {
If[Abs@Sin@# > .5, 1, 0] &,
If[2 < # < 3, 0, #] &,
1/Sin@# + 1 &,
Tan};
pk = Table[{Plot[fun[x], {x, 0, 10}], pl[fun, {0, 10}]}, {fun, flist}];
GraphicsGrid[pk]
Here are side by side the results from Plot (without Options) and from this function:

Edit 2
Found a counterexample, and perhaps some comprehension about what is going on there.
f = If[Abs@Sin@# > .5, 2, 5] &
Does not work. Why? It's easy ... the discontinuity does not cross f[u]==1 ...
Doing a Reap-Sow on the Plot (as in @rcollyer's answer) I saw that adding the Exclusions with f[u]==1 adds a few points to the trace just around f[u]==1 and seems that that is the trigger for excluding the discontinuities from the domain.
Now trying to find a way to change the f[u]==1 for something that works better ...
Edit 3
Found a way with a discrete derivative, a tricky thing.
Like this:
(*Function Definition*)
pl[f_, lims_] := Plot[f[u], {u, lims[[1]], lims[[2]]},
Exclusions -> {(f[u] - f[u + .1])/.1 == 10,
(f[u] - f[u + .1])/.1 == -10}];
Note two issues:
- I had to remove the "True" or "Automatic" option from the Exlusions
- Taking Abs[] for joining the two Exclusion equalities does not work since it's monitoring the evolution of the lhs ...