Consider the Dirichlet function

Recall that this function looks to our imperfect eyes like two lines,

but in fact those lines consist of infinitely many dots with infinitely many gaps between them. For details see Functions - Theory - Elementary functions - Dirichlet function.

We claim that this strange function is not integrable on any closed interval. Consider numbers a < b. We will prove that f is not Riemann integrable on [a,b].

Indeed, pick any partition P of [a,b]. Now consider one of the segments [xk−1,xk], where k = 1,...,N.
Since rational numbers are dense, there must be a rational number inside [xk−1,xk], and therefore Mk = 1.
Similarly, since irrational numbers are dense, there must be an irrational number inside [xk−1,xk] and therefore mk = 0.

Consequently,

This is true for any partition P, therefore

and the function is not Riemann integrable on [a,b].