Your third example should work and is probably a bug, which I've registered as Issue #3255:
myDb.selectFrom(TBL)
.where(DSL.cast(TBL.COL, MySQLDataType.BINARY)
.eq(DSL.cast("foobar ", MySQLDataType.BINARY)))
.fetchOne();
As always, if you're missing a feature in jOOQ, or if you've encountered a bug, you can resort to using plain SQL as documented here:
An example to work around In your case:
myDb.selectFrom(TBL)
.where(TBL.COL
.eq(DSL.field("BINARY ?", String.class, "foobar ")))
.fetchOne();
Or:
myDb.selectFrom(TBL)
.where("{0} = BINARY {1}", TBL.COL, DSL.val("foobar "))
.fetchOne();