I asked a similar question a few days ago, having had an accident with a good-size fruit parting company with the parent plant. I was assured they are good to eat at any stage of their development, so I cooked it and thoroughly enjoyed it 8).
However, if you anticipate storing the squash for any length of time, that is to say more than a few days, I suspect it'd best be ripened on the plant. The stem on my unripe fruit was "weeping" noticeably, so I imagine the fruit would dry out quite quickly in this state. With the fruit fully ripened and the stem dried out, the moisture is less likely to escape.