Of course I've seen the communal bear boxes at parking lots and trailheads padlocked only to find that an NPS employee quickly took a bolt cutter to it in less than an hour.
I'm pretty sure that one could lock an individual campsite bear box. I've heard of people putting items in their campsite bear boxes and having them stolen rather quickly. I'm not sure about what lengths thieves might go to break into locked bear boxes, but I would suspect someone not wearing an NPS uniform carrying around bolt cutters would look very suspicious.
I couldn't find anything that specifically addresses this at family campsites. Would padlocking an individual bear box be frowned upon? In any case I hear the new Upper Pines bear boxes at most sites are a newer model. Are these the ones with a captive square key or something else? Is there any place to use a padlock? The old ones with the bolt and clip did have a place where a padlock could be secured, but man those things were dangerous. I bruised my finger when it got caught in the clip. The website photos show them open without a good look at the locking mechanism. Looked at a bunch of site photos on yosemitecampsites.com, but couldn't see anything close enough to see what the exact mechanism is and whether it can be padlocked.
http://www.nps.gov/yose/planyourvisit/lockers.htm
When I was in the backpackers campground I had a site to myself, but I might have had to share a bear box if someone asked to double up on the campsite.