You can use SetNPCSelectability to lock a party member.
void main() {
SetNPCSelectability(<Party Members Integer Value>, FALSE);
}
I think the values for party members are as follows:
0 - Bastila
1 - Canderous
2 - Carth
3 - HK-47
4 - Jolee
5 - Juhani
6 - Mission
7 - T3-M4
8 - Zaalbar
But I'm not totally sure (that's just the order it goes on the party select screen). Alternatively you can use SetAreaUnescapable() which stops you from being able to change your party entirely.