If an "input" element, outside a "form" container, does not have a "form" attribute, it will simply not be connected in anyway to that form.
Your understanding is correct. An <input> which is not contained within a <form> will not by default be associated with any <form>, and thus won't be included when submitting any <form>. For example, this <input> isn't part of any <form>:
<input name="test" />
<form>
<!-- other inputs, etc. -->
</form>
But this one is:
<input name="test" form="myForm" />
<form id="myForm">
<!-- other inputs, etc. -->
</form>
How exactly is it going to get "associated with the nearest form container"?
That's not what the documentation you're reading says. It's a small but important distinction (emphasis added):
If this attribute isn't specified, the element is associated with the nearest containing form, if any.
So if the <input> is contained within a <form> then it doesn't need to specify. For example, this <input> isn't part of any <form>:
<input name="test" />
<form>
<!-- other inputs, etc. -->
</form>
But this one is:
<form>
<input name="test" />
<!-- other inputs, etc. -->
</form>
By "nearest" containing form it's likely indicating that nested <form> elementss are legal, and the <input> will by default be associated only with the closest ancestor <form>. Though nested <form> elements sounds to me like a recipe for confusion. Allowed and useful in edge cases, but in the vast majority of cases really not necessary.
The "nearest" in "nearest containing form" may just be redunant. The <input> should only exist within a single ancestor <form> element.