Well, it may be that no record of her birth or baptism has survived, and if she wasn't married to William there obviously wouldn't be a marriage record.
If James was illegitimate, there is a possibility that his arrival in the world might have attracted the usual disapproval of the kirk session, and if their record have survived there might be some information there about his parents. Unfortunately the KS records are not (yet) available online, although they have been digitised. Also they are not indexed, so you just have to plough through them looking for the people of interest.