Any attribute can be selected with CSS or jQuery using the [] notation. CSS applies to any XML-like syntax, not just HTML -- it doesn't know (or care) what attributes are "valid" as long as the structure is well-formed.
.error[for='username'] {
}
or for a "starts with"
.error[for^='userprefix'] {
}