Most OpenGL implementations do have an upper limit on the number of bindings afforded to Attributes, Uniforms, etc. So if you specify a number above the maximum limit, the GL might not handle it correctly.
But a lot of it is implementation specific. An implementation might, for example, only allow up to 16* attribute locations, but has no problem indexing any valid integer value so long as the number of unique locations doesn't exceed 16.
More importantly, there's no limit on simply skipping locations:
layout(location = 0) in vec2 vertex;
layout(location = 1) in vec4 color;
layout(location = 3) in uint indicator;
layout(location = 7) in vec2 tex;
Which, of course, you bind as expected:
glEnableVertexArrayAttrib(0);
glEnableVertexArrayAttrib(1);
glEnableVertexArrayAttrib(3);
glEnableVertexArrayAttrib(7);
//Assuming all the data is tightly packed in a single Array Buffer
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, (void*)(36));
glVertexAttribPointer(1, 4, GL_FLOAT, false, 8, (void*)(36));
glVertexAttribIPointer(3, 1, GL_UNSIGNED_INT, 24, (void*)(36));
glVertexAttribPointer(7, 2, GL_FLOAT, false, 28, (void*)(36));
*I haven't looked it up, but I do know OpenGL guarantees that implementations support at least some number of Attribute and Uniform locations and bindings. I don't know what that number is, but the number '84' keeps popping into my head for some reason.