I am looking for a function $f:[0\;\pmb,\;1]\to\Bbb R\setminus\{0\}$ such that$$\int_a^bf(x)\;\mathrm dx=0\quad\text{for all }a,b\in[0\;\pmb,\;1].$$
Clearly such a function cannot be Riemann-integrable. But is there one under a more-general (e.g. Lebesgue) type of integration? The more I look at it, the more I doubt it. But I can't prove that there is no such function.
As copper.hat stated in a comment, if $f$ is Lebesgue integrable and satisfies your condition, then $f(x)=0$ almost everywhere.
Now if $f$ additionally is continous, then $f(x)=0$ everywhere.
If on the other hand $f$ is not continuous, this doesn't need to be true. For example $f(1/2)=1$ and $f(x)=0$ otherwise is Lebesgue integrable and satisfies your condition.