||Who hath measured the waters in the hollow of his hand, and meted out heaven with the span, and comprehended the dust of the earth in a measure, and weighed the mountains in scales, and the hills in a balance?
||Who hath directed the Spirit of the LORD, or being his counsellor hath taught him?
||With whom took he counsel, and who instructed him, and taught him in the path of judgment, and taught him knowledge, and shewed to him the way of understanding?
||מִֽי־מָדַ֨ד בְּשָׁעֳלֹ֜ו מַ֗יִם וְשָׁמַ֨יִם֙ בַּזֶּ֣רֶת תִּכֵּ֔ן וְכָ֥ל בַּשָּׁלִ֖שׁ עֲפַ֣ר הָאָ֑רֶץ וְשָׁקַ֤ל בַּפֶּ֨לֶס֙ הָרִ֔ים וּגְבָעֹ֖ות בְּמֹאזְנָֽיִם׃
||מִֽי־תִכֵּ֥ן אֶת־ר֖וּחַ יְהוָ֑ה וְאִ֥ישׁ עֲצָתֹ֖ו יֹודִיעֶֽנּוּ׃
||אֶת־מִ֤י נֹועָץ֙ וַיְבִינֵ֔הוּ וַֽיְלַמְּדֵ֖הוּ בְּאֹ֣רַח מִשְׁפָּ֑ט וַיְלַמְּדֵ֣הוּ דַ֔עַת וְדֶ֥רֶךְ תְּבוּנֹ֖ות יֹודִיעֶֽנּוּ׃
The bolded Hebrew word in verse 12 is an interrogative particle (מִֽי/mî), translated here as "Who," but could mean whoever, whose, whom, who, or whosoever. Essentially, it is not identifying a personage, nor specifying any gender or number: it is just a question word.
Verse 13 begins with that same particle (also bolded above).
Later in verse 13, the Hebrew nouns (bolded above) ר֖וּחַ/ruah and יְהוָ֑ה/Yahweh appear together after the direct object marker אֶת־/’eṯ- (not translated). The DOM causes the object that follows to become a definite noun if it were not already, which simply means we should have "the" and/or indicate that it is a proper noun.
Though Hebrew does not have upper and lower case letters as does English, the DOM tells us that the subsequent noun is a proper noun, therefore the capitalization of "Spirit" in English is proper. However, the nouns are in construct chain, since both "Spirit" and "Yahweh" (all names are automatically proper, and Yahweh is a name) are definite/proper nouns. As a construct chain, the words are linked together, usually by "of" in English, as being part of the same entity.
A Little About Construct Chains
For example, if we had "pile wood" in Hebrew, it would be "pile of wood" in translation, and the phrase is all part of one noun. If there were an inequality in definiteness, for example if one or the other word had a "the" prefix in Hebrew, e.g. "the pile wood" or "pile the wood", then it would no longer be a construct chain, for the inequality would imply a verb of being: e.g. "the pile is wood." It gets interesting.
But for Isaiah 40:13, it is in construct form, which is why the translation comes through as "Spirit of the LORD" (KJV), and would be better translated as "Spirit of Jehovah" (or Yahweh). The Hebrew links the words as being a single entity.
Verse 14 begins with the direct object marker, but a Hebrew sentence does not begin with an object. This means that it is functioning as the English preposition "with" and not as a DOM, hence the interrogative here beginning with "with whom", as the next word is the "who" in Hebrew again--or perhaps you can consider that the word following the DOM must be the object of a preposition, and the DOM functions as that preposition itself.
The "he" which follows in verse 14 in "took he counsel" is not explicitly given in Hebrew, i.e. there is no pronoun present; neither pronominal suffix, nor prefix. However, the verb is in the form of third-person masculine singular, which means English legitimately requires the addition of the pronoun "he".
The next two verbs in verse 14 both have the masculine pronominal suffix, which is why "him" is added after them. They also both begin with the "and" conjunction in Hebrew because of their verb forms. (This type of "and" is not always translated, but KJV is usually more likely to do so, which is one reason it seems more poetic at times.) Note that the pronominal suffixes are both in singular, not plural; another indication that the Hebrew addresses a single entity.
Obviously, the questions are rhetorical. They are meant to show their hearer the futility of comparing his own wisdom or knowledge against that of God.
As for any link to a trinity or trinitarian concept, there's not a trace of it in this passage. There is no mention of a father or a son in this passage, and it would be hermeneutically improper to suggest the presence of such concepts given its language.