Can't use user data???
How about this, I think it's a typical way to handle things (just written off the top of my head, could contain typos+errors

):
Code:
//set a struct in the user data
struct bodyUserData {
int numJointsAttached;
... other useful stuff...
};
//on body creation
bodyUserData* bud = new bodyUserData();
bud->numJointsAttached = 0;
body->SetUserData( bud );
//later, in collision callback etc
b2Body* body = contact->GetFixtureA()->GetBody();
bodyUserData* bud = (bodyUserData*)body->GetUserData();
if ( bud ) {//unless you set a bodyUserData in EVERY body, you should check this
if ( bud->numJointsAttached < 2 ) {
...do cool stuff...
}
}
//at body destruction
bodyUserData* bud = (bodyUserData*)body->GetUserData();
if ( bud )
delete bud;
world->DestroyBody( body );