You are looping in the $allObjects array through more items than the array contains, changing the 10 (it seems you have less than 10 objects selected) for the size of the selection works for any number of selected objects, otherwise you have to use
$a < (number of selected objects):
///////////////////////////////////////////////////////////////////////////
string $allObjects[] = ls -sl;
print $allObjects;
for ($a=0; $a < size($allObjects); $a++)
{
$cell_state = getAttr($allObjects[$a]+".buildingParcelRelation");
print ($cell_state+"\n");
}
///////////////////////////////////////////////////////////////////////////