The ratification involves, as you've cited correctly, only national parliaments. Indeed are there only 27/28 member states (post/pre-Brexit respectively), but the total number of parliaments that have to ratify depends on the constitutions of the member states. The following 13 states have a bicameral system,
- Czech Republic
- The Netherlands
- United Kingdom
Therefore, there are 28+13=41 national parliaments pre-Brexit and 39 post-Brexit involved in ratifying such treaties. (Note that certain member states can invoke a referendum for the ratification process). However, not all of these parliaments are required for the ratification (as pointed out in the comment below).
The following document has an overview of all the specifics of the ratification process, and it shows that second chambers of Belgium, Ireland, and Slovenia do not need to ratify the treaty, which would be 36/38 national parliaments in total. In the pre-Brexit case, the House of Lords can just delay the process of ratification (see comments here and here below as well as notes related to UK in the aforementioned document).
However, Belgium is the exception here on all levels: The Belgian constitution transfers certain legislative powers down to regional bodies and even assemblies, the situation here is quite intricate.
The same document summarizes the Belgian institutions involved in the ratification:
Parliaments of the federated entities:
French-speaking Community in Brussels,
Joint Assembly of the Common Community Commission in Brussels
The Belgian constitution is dividing Belgium into three regions (Wallonia, Flanders and Brussels-Capital) and three communities (French, Flemish, and German-speaking), where the Flanders region and the Flemish community are unified into one parliament.
Each of the five components of the federal system (Flemish Community, French Community, German-speaking Community, Walloon Region and Brussels-Capital Region) have their own, directly elected unicameral council or parliament. They vote decrees (or ordinances in Brussels), that have the same value and are on the same juridical level as the federal laws. ¹
The Walloon-Brussel Federation is essentially the representation of the French community; the parliament is formed by members of the Walloon parliament and French-speaking members in the parliament of Brussels-Capital ².
The French Community Commission in Brussels needs also to be asked, since
Unlike the Flemish Community Commission, the French Community Commission has been granted legislative power in some areas (such as tourism and healthcare) by the French Community. [ibid.]
And finally the Joint Assembly of the Common Community Commission in Brussels has also legislative powers and is responsible for community matters that do not fall into the competencies of either community in Brussels.
Which of these bodies can veto other agreements like TTIP or the Brexit agreement depends on the content of the treaties. I suppose the Brexit agreement is not touching upon bilingual issues in Brussels, so probably the last body mentioned in the list will not be deciding about the Brexit agreement. The same is probably true for some of the other bodies mentioned in the list. But this is just speculation as long as there is no actual treaty text.
It is probably useful to cite the rest of the Belgium section in the aforementioned document:
- The Kamer/Chambre has to approve all mixed agreements. The Senate/Sénat no longer has ratification powers.
The parliaments of the federated entities in Belgium must also approve mixed agreements if the content of the agreement touches upon their competences.
Referendums are not provided for according to Belgian law.
The draft/proposal to approve a mixed agreement is sent to the House of representatives from which point it is dealt with by the competent committee. Following discussions and a vote in this committee,
the text is then subjected to a vote in a plenary session determined by a simple majority. Where agreements directly affect federated competences, approval from the competent parliaments of the
federated entities is required. There are potentially 7 parliaments concerned. The required parliamentary approval in Belgium is concluded only when all competent parliaments of the federated entities and the Kamer/Chambre have given their consent. There is no scope for a referendum on mixed agreements.