I ended up building the project separately and moving this version to another namespace. This is apparently not so uncommon. For example Hibernate keeps cglib in its own namespace in order to avoid version conflicts due to API changes.
The first suggested solution had a problem when the project I used was also used in another dependency what led to that both my modified version and the normal version were on the class path what led to very strange behavior due to naming conflicts.
The second and third suggestion had similar problems as the first suggestion. Additionally, I broke compatibility to other versions of the dependency.
Even it sounds painful: Moving out of the namespace and providing a seperate build is a must, even if you only change a few lines of code.